Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
More complicated with Linq
Message
De
11/04/2012 10:01:49
 
 
À
11/04/2012 09:25:03
Information générale
Forum:
ASP.NET
Catégorie:
LINQ
Versions des environnements
Environment:
VB 9.0
OS:
Windows 7
Network:
Windows 2003 Server
Database:
MS SQL Server
Application:
Web
Divers
Thread ID:
01540963
Message ID:
01541047
Vues:
31
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)
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform