Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Lambda declaration
Message
De
21/11/2014 12:24:15
John Baird
Coatesville, Pennsylvanie, États-Unis
 
Information générale
Forum:
ASP.NET
Catégorie:
LINQ
Versions des environnements
Environment:
C# 5.0
OS:
Windows 7
Network:
SAMBA Server
Database:
MS SQL Server
Application:
Desktop
Divers
Thread ID:
01611296
Message ID:
01611299
Vues:
44
>Hi John, I figured it out, ITariffDataImport is the interface my class implements and the string is one of three class properties that I possibly want to group by. I had to use parentheses instead of angle brackets after Func because of UT rendering limitations
>
>
>
>Func(ITariffDataImport, string) grp = null;
>                
>                if (App.ImportSettings.RemoveDuplicates)
>                {
>                    Console.WriteLine("Removing duplicate tariffs...");
>                    
>                    if (App.tariffType == TariffType.BTInternational)
>                        grp = s => s.Destination;
>                    else
>                        if (App.tariffType == TariffType.BTNational118)
>                            grp = s => s.ChargeBand;
>                        else
>                            if (App.tariffType == TariffType.BTNationalIP)
>                                grp = s => s.Service;
>
>                    xlistint.Data = xlistint.Data.GroupBy(grp).Select(s => s.First()).ToList();
>
>
>nice and clean I think.

Yep.. I'll have to give that a whirl myself...
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform