I have a linq query that does something simple like:
var k = people.Select(x=>new{x.ID, x.Name});
I then want a function or linq lambda,
How about this?
var k = people.Select(x=>new{x.ID, x.Name}); var stringified = people .Select(x => string.Format("{0} : {1}", x.ID, x.Name)) .ToList(); return string.Join(", ", stringified.Take(stringified.Count-1).ToArray()) + " and " + stringified.Last();