I have a DC LoadResult
with DataMemebers of type List<string>
public partial class LoadResult : ServiceResult
{
[DataMember]
public List<string> Country { get; set; }
[DataMember]
public List<string> AuditStatus { get; set; }
}
trying to fill in these values in my DO by doing the following steps.
LoadResult LResult = new LoadResult ();
//Code to connect to database , retrive appropriate values
string x = "some string value retrieved from database";
LResult.Country.Add(x);
the last line of code throws me an object reference not set to an instance error, this might be some fundamental thing that i have missed here, but since i have initialized the DC class with the new keyword, i am clueless as to what the error is, Can you help me out here
you need to do
LResult.Country = new List<string>();
before you add values