Well yes, of course you are - and thirty seconds with the debugger would have shown you why! Once it compiled, that is (there is no property
objHeader
in the
GetRoleDetailsResponse
class)
You create a new instance of the container class
GetRoleDetailsResponse
but you don't populate either of the fields it contains.
Try adding defaults to your properties:
public class GetRoleDetailsResponse
{
public Header Header { get; set; } = new Header();
public List<Detail> Details { get; set; } = new List<Detail>();
}
You'll still get an error on the other line because the list is empty so element 0 doesn't exist, but ... I'm sure you can fix that!