I have a class
public class C
{
public int Id { get; set; }
public SqlXml Range { get; set; } // System.Data.SqlTypes.SqlXml
}
And the following code is used to read the data from web api.
List<C> cs = null;
var response = await client.GetAsync(url);
if (response.IsSuccessStatusCode)
{
cs = await response.Content.ReadAsAsync<List<C>>(); // cs[..].Range is null
}
The following is some sample Json file returned from the Web API.
[{"id":0,"range":{"isNull":false,"value":"<Range>....</Range>"}},
{"id":1,"range":{"isNull":false,"value":"<Range>...</Range>"}},
{"id":2,"range":{"isNull":false,"value":"<Range>....</Range>"}}]
However, the variable cs got the following values. The Id values are correct. But all the Ranges got null values?
0, null
1, null
2, null
The debugger shows cs[...].Range.IsNull is true.
SqlXmlclass. maybe json.net is unable to desrialize that object, but will need to see what it looks like.System.Data.SqlTypes. I didn't define it.