Default Constructor VS non default

Feb 6, 2012 at 7:50 PM
Edited Feb 6, 2012 at 7:51 PM

I have json data: 

{

 "Id": null

}

1) in case my class is following, Id is deserialized as null. This is really what I expect to see.

public class NullableGuid {

public Guid? Id { get; set; }

public NullableGuid() {}

}

2) in case of following class, Id is deserialized as Guid.Empty. And this is really odd.

public class NullableGuid {

  public Guid? Id { get; set; }

  public NullableGuid(Guid id) {

Id = id;

}

}

 

Is it a bug?

Feb 6, 2012 at 10:19 PM

Issue described above is actual for version 4.0.2

Seems it's fixed in the latest build.