A better approach would be to have a separate class with properties for
Branch and make it child to the
Users. Maybe something like following-
public class Branch{
public string BranchId { get; set; }
public string BranchName { get; set;}
}
public class Users
{
public string UserName { get; set; }
public string Password { get; set; }
public string MessageStatus { get; set; }
public int StatusCode { get; set; }
public string StatusText { get; set; }
public string IpAddress { get; set; }
public string BrowserInfo { get; set; }
public IList<Branch> Branches {get;set;}
}
And to convert your datatable to IList of Branch, you can try doing something like following-
var branches = from yourDataTable in YourDataTable.AsEnumerable()
select new Branches
{
BranchId = Convert.ToString(yourDataTable["BranchId"]),
BranchName = Convert.ToString(yourDataTable["BranchName"])
};
Please let me know if this doesn't work.
Thanks