1

I created a class, with a member marked as a JsonProperty, and never explicitly referred to this member, but did JsonConvert.SerializeObject, which used it implicitly.

My compilation fails, however, claiminig that this member is defined and never used. (error CS0414: The field X is assigned but its value is never used) I suppos that I can suppress this error, but I am not sure that would be the correct solution.

Would appreciate your thoughts on the matter.

yuvalm2
  • 742
  • 7
  • 23
  • 1
    Where is your code? – Patrick Hofman May 15 '17 at 14:27
  • 1
    That's usually a warning, not an error. Do you have errors as warnings turned on (not that that's a bad thing)? – Kenneth K. May 15 '17 at 14:30
  • You can [suppress a warning](http://stackoverflow.com/q/3820985/1997232) for this field and that's the right way to do in your case. Of course you can achieve goal by other meaning: use property or make field `protected` (this is mentioned in the error link). – Sinatr May 15 '17 at 14:44

0 Answers0