I have simple linq query with join statement results in anonymous type. The problem is two properties have same name. How to get this to work. Suppose I have the following code
Dim retQry = From cb In _entityCtx.CandyBars Join soda in _entityCtx.Drinks On cb.Id Equals soda.Id Select cb.Id, Soda.Id, Soda.Price, cb.Name I get the error Range variable Id is already declared.
UPDATE: Found microsoft document that shows only property name is used hence 'Id' is field that gets passed around. In anonymous types from query express https://msdn.microsoft.com/en-us/library/bb384767.aspx
cbIdandSodaId, in C# it is likeselect new { cbId = cb.Id, SodaId = soda.Id....Select new { cbid = cd.Id, sodaid= Soda.Id, ...?