object to deserialize has a C# keyword

Change

public class Event
{
    public int event { get; set; }
    public EventDetail data { get; set; }
}

to this

public class Event
{
    public int @event { get; set; }
    public EventDetail data { get; set; }
}

This tip shows the quirks involved with escaping in C#:

  • character literal escaping:

e.g. ‘\”, ‘\n’, ‘\u20AC’ (the Euro € currency sign), ‘\x9’

(equivalent to \t))
literal string escaping:

e.g. “…\t…\u0040…\U000000041…\x9…”

  • verbatim string escaping:

e.g. @”…””…”

  • string.Format escaping:

e.g. “…{{…}}…”

  • keyword escaping:

e.g. @if (for if as identifier)

  • identifier escaping:

e.g. i\u0064 (for id)

Leave a Comment