Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Lambda declaration
Message
 
À
21/11/2014 11:33:57
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:
01611298
Vues:
46
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.
Regards,
Peter J. Kane



Pete
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform