Click here to Skip to main content
15,887,027 members
Home / Discussions / C#
   

C#

 
GeneralRe: Convert C++ code, with calls to ATL, into C# to quickly get com ports and their friendly names? Pin
arnold_w6-Jun-18 0:39
arnold_w6-Jun-18 0:39 
QuestionIN DESPERATE NEED OF IDEAS FOR NEW PROJECTS IN C# .NET Pin
KFC MANAGER 694-Jun-18 6:25
KFC MANAGER 694-Jun-18 6:25 
AnswerRe: IN DESPERATE NEED OF IDEAS FOR NEW PROJECTS IN C# .NET Pin
OriginalGriff4-Jun-18 6:34
mveOriginalGriff4-Jun-18 6:34 
Answerre: in desperate need of ideas for new projects in c# .net Pin
BillWoodruff4-Jun-18 6:48
professionalBillWoodruff4-Jun-18 6:48 
AnswerRe: IN DESPERATE NEED OF IDEAS FOR NEW PROJECTS IN C# .NET Pin
Gerry Schmitz5-Jun-18 5:18
mveGerry Schmitz5-Jun-18 5:18 
AnswerRe: IN DESPERATE NEED OF IDEAS FOR NEW PROJECTS IN C# .NET Pin
#realJSOP6-Jun-18 3:32
mve#realJSOP6-Jun-18 3:32 
QuestionJSON problem with backslash through REST service Pin
Member 90507314-Jun-18 5:30
Member 90507314-Jun-18 5:30 
AnswerRe: JSON problem with backslash through REST service Pin
Richard Deeming4-Jun-18 5:53
mveRichard Deeming4-Jun-18 5:53 
Returning raw json (string) in wcf - Stack Overflow[^]
WCF "Raw" programming model (Web) – Carlos Figueira MSDN blog[^]

When you return a string with ResponseFormat = Json, the string will be JSON-encoded, and the client will receive a string.

If you want to send raw JSON, the simplest option is to return a Stream instead.
C#
[ServiceContract()]
interface IRestService
{
    /// <summary>
    /// Return a json string
    /// </summary>
    /// <returns></returns>
    [OperationContract()]
    [WebGet(ResponseFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.Bare) ]
    System.IO.Stream GetJson();
}

...

public Stream GetJson()
{
    string retJson = "{\"firstname\": \"Georg\", \"name\": \"Clooney\"}";
    WebOperationContext.Current.OutgoingResponse.ContentType = "application/json; charset=utf-8";
    return new MemoryStream(Encoding.UTF8.GetBytes(retJson));
}




"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer

Questionsend sms from c# windows application Pin
Mohamed Fahad M2-Jun-18 21:53
Mohamed Fahad M2-Jun-18 21:53 
AnswerRe: send sms from c# windows application Pin
OriginalGriff2-Jun-18 22:14
mveOriginalGriff2-Jun-18 22:14 
QuestionC sharp code for Objective and subjective CBT Exam Pin
Member 1293991431-May-18 0:39
Member 1293991431-May-18 0:39 
AnswerRe: C sharp code for Objective and subjective CBT Exam Pin
Richard MacCutchan31-May-18 0:47
mveRichard MacCutchan31-May-18 0:47 
AnswerRe: C sharp code for Objective and subjective CBT Exam Pin
OriginalGriff31-May-18 2:24
mveOriginalGriff31-May-18 2:24 
AnswerRe: C sharp code for Objective and subjective CBT Exam Pin
Gerry Schmitz31-May-18 11:43
mveGerry Schmitz31-May-18 11:43 
QuestionSERIAL MONITOR IN C#, DataReceivedHandler problem Pin
Member 1368881630-May-18 22:19
Member 1368881630-May-18 22:19 
QuestionRe: SERIAL MONITOR IN C#, DataReceivedHandler problem Pin
Richard MacCutchan30-May-18 23:00
mveRichard MacCutchan30-May-18 23:00 
AnswerRe: SERIAL MONITOR IN C#, DataReceivedHandler problem Pin
Member 1368881630-May-18 23:29
Member 1368881630-May-18 23:29 
AnswerRe: SERIAL MONITOR IN C#, DataReceivedHandler problem Pin
Jochen Arndt30-May-18 23:39
professionalJochen Arndt30-May-18 23:39 
AnswerRe: SERIAL MONITOR IN C#, DataReceivedHandler problem Pin
Gerry Schmitz31-May-18 11:50
mveGerry Schmitz31-May-18 11:50 
AnswerRe: SERIAL MONITOR IN C#, DataReceivedHandler problem Pin
Member 1368881631-May-18 23:04
Member 1368881631-May-18 23:04 
QuestionIs there a JSON Library that works like the System.Xml.Linq classes? Pin
MAIsw30-May-18 21:02
MAIsw30-May-18 21:02 
AnswerRe: Is there a JSON Library that works like the System.Xml.Linq classes? Pin
Pete O'Hanlon30-May-18 22:31
mvePete O'Hanlon30-May-18 22:31 
QuestionCreate JSON object from string Pin
WillyBilly9030-May-18 10:27
WillyBilly9030-May-18 10:27 
AnswerRe: Create JSON object from string Pin
Mycroft Holmes30-May-18 14:17
professionalMycroft Holmes30-May-18 14:17 
GeneralRe: Create JSON object from string Pin
WillyBilly9031-May-18 9:57
WillyBilly9031-May-18 9:57 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.