So lets say I have a class object called SomeObject, and one called NamesObject
public class NamesObject
{
public string FirstName {get; set;}
public string LastName {get; set;}
}
public class SomeObject
{
public List<NamesObject> Names {get; set;}
}
Then I do a LINQ query that ends with a select of a new SomeObject, I want to do something like this, but I can't work it out, or even if you can do it?
var N = (from x in sometable
select new SomeObject {
Names = new List<NamesObject>().Add(new NamesObject { x.FirstName, x.LastName })
});