Click here to Skip to main content
15,885,767 members
Home / Discussions / C#
   

C#

 
GeneralRe: Voice Over IP Pin
Umant Narayan23-Aug-16 11:27
Umant Narayan23-Aug-16 11:27 
GeneralRe: Voice Over IP Pin
Dave Kreskowiak23-Aug-16 12:30
mveDave Kreskowiak23-Aug-16 12:30 
GeneralRe: Voice Over IP Pin
Umant Narayan23-Aug-16 13:06
Umant Narayan23-Aug-16 13:06 
GeneralRe: Voice Over IP Pin
Dave Kreskowiak23-Aug-16 15:05
mveDave Kreskowiak23-Aug-16 15:05 
GeneralRe: Voice Over IP Pin
Mycroft Holmes23-Aug-16 13:18
professionalMycroft Holmes23-Aug-16 13:18 
AnswerRe: Voice Over IP Pin
Maciej Los23-Aug-16 10:54
mveMaciej Los23-Aug-16 10:54 
QuestionSerialize .Net Framework Enums Pin
Kevin Marois23-Aug-16 6:54
professionalKevin Marois23-Aug-16 6:54 
AnswerRe: Serialize .Net Framework Enums Pin
Richard Deeming23-Aug-16 7:31
mveRichard Deeming23-Aug-16 7:31 
According to this blog post[^], you can either decorate the property with the JsonConverter attribute:
C#
[JsonConverter(typeof(StringEnumConverter))]
public WatcherChangeTypes ChangeTypes { get; set; }

or add the converter to the serializer globally:
C#
public class Startup
{
    public void Configuration(IAppBuilder app)
    {
        var serializer = new JsonSerializer();
        serializer.Converters.Add(new StringEnumConverter());
        GlobalHost.DependencyResolver.Register(typeof(JsonSerializer), () => serializer);

        app.MapSignalR();
    }
}

Although I suspect it might be better to add the converter to the default settings, rather than reusing the same serializer instance for every call:
C#
public class Startup
{
    public void Configuration(IAppBuilder app)
    {
        JsonConvert.DefaultSettings = () => new JsonSerializerSettings
        {
            Converters =
            {
                new StringEnumConverter()
            }
        };

        app.MapSignalR();
    }
}




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


GeneralRe: Serialize .Net Framework Enums Pin
Kevin Marois23-Aug-16 7:40
professionalKevin Marois23-Aug-16 7:40 
AnswerMessage Closed Pin
23-Aug-16 9:42
professionalBillWoodruff23-Aug-16 9:42 
GeneralRe: Serialize .Net Framework Enums Pin
Kevin Marois23-Aug-16 9:56
professionalKevin Marois23-Aug-16 9:56 
QuestionEmail tracking in c# read/not read Pin
Member 1269682821-Aug-16 23:43
Member 1269682821-Aug-16 23:43 
AnswerRe: Email tracking in c# read/not read Pin
OriginalGriff21-Aug-16 23:56
mveOriginalGriff21-Aug-16 23:56 
JokeRe: Email tracking in c# read/not read Pin
Mycroft Holmes22-Aug-16 12:58
professionalMycroft Holmes22-Aug-16 12:58 
GeneralRe: Email tracking in c# read/not read Pin
OriginalGriff22-Aug-16 21:35
mveOriginalGriff22-Aug-16 21:35 
QuestionVisual Studio - how to change "var" to corresponding class Pin
Member 1094519421-Aug-16 0:14
Member 1094519421-Aug-16 0:14 
AnswerRe: Visual Studio - how to change "var" to corresponding class Pin
OriginalGriff21-Aug-16 0:44
mveOriginalGriff21-Aug-16 0:44 
AnswerRe: Visual Studio - how to change "var" to corresponding class Pin
BillWoodruff21-Aug-16 0:52
professionalBillWoodruff21-Aug-16 0:52 
GeneralRe: Visual Studio - how to change "var" to corresponding class Pin
OriginalGriff21-Aug-16 1:46
mveOriginalGriff21-Aug-16 1:46 
GeneralRe: Visual Studio - how to change "var" to corresponding class Pin
F-ES Sitecore21-Aug-16 23:05
professionalF-ES Sitecore21-Aug-16 23:05 
GeneralRe: Visual Studio - how to change "var" to corresponding class Pin
Maarten197722-Aug-16 1:57
Maarten197722-Aug-16 1:57 
GeneralRe: Visual Studio - how to change "var" to corresponding class Pin
F-ES Sitecore22-Aug-16 2:04
professionalF-ES Sitecore22-Aug-16 2:04 
JokeRe: Visual Studio - how to change "var" to corresponding class Pin
Richard MacCutchan22-Aug-16 2:09
mveRichard MacCutchan22-Aug-16 2:09 
GeneralRe: Visual Studio - how to change "var" to corresponding class Pin
Maarten197722-Aug-16 2:35
Maarten197722-Aug-16 2:35 
GeneralRe: Visual Studio - how to change "var" to corresponding class Pin
Pete O'Hanlon22-Aug-16 2:45
mvePete O'Hanlon22-Aug-16 2:45 

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.