Musakkhir Sayyed Musakkhir Sayyed - 1 year ago 59
JSON Question

How do I add `+` to a property name in C#?

How do I declare a property or variable name as

in C#?

public string fg+ { get; set; }

I am getting
as a field in a response from JSON as
"fg+": "103308076644479658279"

I am deserializing it using a class. How do I read it from JSON?

Answer Source

Such a variable name isn't legal in C#.

If you're using Json.NET to deserialize your data, you can use the JsonProperty attribute to give it a custom name:

public string Fg { get; set; }
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download