How to deserialize the "ref" parameter
I am trying to parse a json file that contains a parameter named ref. I am deserializing into a class structure:
public class JiveContentObject
{
public int id { get; set;}
public string subject { get; set;}
..etc
}
however I cannot write exactly public string ref {get; set;}
as it ref
is a keyword in C #. Is there a way to get around this?
+3
creitz
source
to share
1 answer
Prefix the identifier with @
:
public class JiveContentObject
{
public int id { get; set; }
public string subject { get; set; }
public string @ref { get; set; }
}
This is exactly what it exists for.
+7
Servy
source
to share