I'm receiving build errors in the class properties when getting & setting an enumeration of another class that has it's own separate getters & setters. There are two of the same errors in the get {} statement of the following code. I'm not sure as to how to resolve the build errors that are displayed as: 'Only assignment, call, increment, decrement, await, and new object expressions can be used as a statement'.
public class Data
{
private IEnumerable<Client> _clientData;
private IEnumerable<Company> _companyData;
public IEnumerable<Client> ClientData
{
get { _clientData ?? (_clientData = new List<Client>()); }
set { _clientData = value; }
}
public IEnumerable<Company> CompanyData
{
get { _companyData ?? (_companyData = new List<Company>()); }
set { _companyData = value; }
}
}