I've written the following LINQ query that is attempting to return the StateCode values for all Contact records that match a particular last name
var cs = (from c in myCTX.ContactSet where c.LastName == "Smith" select new Contact { StateCode = c.StateCode }); foreach (Contact c in cs) { }
However, I'm receiving the following error in my code on the StateCode = c.StateCodeline:
Property or indexer 'StateCode' cannot be assigned to -- it is read only
Any idea how I can get around this error?
Thank you