c# - How to set default value instead of null in deserialization -
after deserialization object null, cause exception in deserialization i've avoided problem setting appropriate property in class:
[jsonproperty("jerseynumber", nullvaluehandling = nullvaluehandling.ignore)] public int jerseynumber { get; set; }
the problem after deserialization, value of int
equal 0 because in json null.
want set null
value empty, how can achieve this?
i've tryed with: [defaultvalue("null")]
don't working because value integer.
set int nullable
try following:
public int? jerseynumber { get; set; }
Comments
Post a Comment