This question is locked. New answers and comments are not allowed.
I can flatten out a collection in a linq query to an Anon Type list like this
...and that works
But how do I do that with a .SingleOrDefault() query? Like I have my object, but how do I transform it without creating an entire class file to just hold the one tiny object?
Steve
using (AuthDB.Model.Context context = new AuthDB.Model.Context()) { encounters = (from e in context.EtEncounters.ToList() where e.EncounterName.ToLower().Contains(searchText) select new { ID = e.EncounterID, Name = Server.HtmlEncode(e.EncounterName), Status = "complete", PatientType = "Simulation", ObjectiveType = e.EtObjectiveType.Name }).ToList(); }But how do I do that with a .SingleOrDefault() query? Like I have my object, but how do I transform it without creating an entire class file to just hold the one tiny object?
Steve