Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Setting properties in Generic list
Message
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Versions des environnements
Environment:
C# 5.0
OS:
Windows 7
Network:
SAMBA Server
Database:
MS SQL Server
Application:
Desktop
Divers
Thread ID:
01610922
Message ID:
01610956
Vues:
22
>Nice one Viv I'll give it a go

Two other options (which actually bring nothing to the table - but I had to try them):
list.ForEach(delegate(Info i) { if (i.Postcode.StartsWith("HR"))  i.SomeProperty = true;  });
Or, more reusable:
 private static void MarkPostCode(Info i, string s)
        {
            if (i.Postcode.StartsWith(s)) i.SomeProperty = true; ;
        }
       // used with:
       list.ForEach(i=>  MarkPostCode(i,"HR"));
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform