Is it somehow possible to call a C# variable return?
I need to deserialize JSON data and there is a field called return.
And I am unable to create class with this name to create object for deserialization :-/
Thank you.
Either use @return or simply annotate it (JSON.NET):
[JsonProperty(PropertyName = "return")]
public string MyPropertyName {get; set;}
You can use keywords as identifiers by prefixing them with @:
public int Foo()
{
int @return = 5;
return @return;
}
Note that this is not necessary for the so-called contextual keywords, such as LINQ operators, var and others that came later. Those have special rules where they can appear which allow them to be used as identifiers.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With