LINQ Anonymous Type - Alias
Hi
When creating an anonymous type with the following code
.....
var allShips = from ship in myDataContext.CruiseShips
select new { ship.Name, ship.CruiseLine.Name};
........
I get the following error 'An anonymous type cannot have multiple properties with the same name.' I could avoid this my renaming the fields (LineName & ShipName) but am loathe to mess about with my naming conventions for the sake of making it work. Is it possible to use aliases, or is there a simpler solution?
regards, Guy
|