Musakkhir Sayyed Musakkhir Sayyed - 9 months ago 24
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?


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; }