Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
More complicated with Linq
Message
From
11/04/2012 10:01:49
 
 
To
11/04/2012 09:25:03
General information
Forum:
ASP.NET
Category:
LINQ
Environment versions
Environment:
VB 9.0
OS:
Windows 7
Network:
Windows 2003 Server
Database:
MS SQL Server
Application:
Web
Miscellaneous
Thread ID:
01540963
Message ID:
01541047
Views:
30
This message has been marked as a message which has helped to the initial question of the thread.
>>Hmm. This is, in a way, related to the thread from yesterday. If you make the type of Client.Something 'Damage' and assign an instance of Damage to it then you will be sending the whole object over the wire within Client. If you only need the Damage.Drivable property then make Something a bool (I assume) and keep your code as is.
>
>But, is there a way to declare two Select New in the query because the first one is for all the fields of the main table and there would then be another one for the second object.

No. You can new up an existing type or an anonymous type - no other options. Well you could go down the DLR route (but I don't like it):
var anon = clients.Select(x => new { Surname = x.LastName, GivenName = x.FirstName }).FirstOrDefault();
DoSomething(anon);
Then:
   void DoSomething (dynamic d)
    {
        string Surname = d.Surname;
    }
(Sorry C# version but conversion should be simple)
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform