Henris blogg

 
« Back to blog

Convert a list from one type to another using Predicate and ConvertAll

List<Variabel> lv = new List<Variabel>();

lv.AddRange(liste);

List<string> lst = lv.ConvertAll<string>(delegate(Variabel g) { return g.Navn; });

Converts a list of objects with type Variabel,

to a list of strings.

Variabel contains a string property called Navn, and this is what gets transelted to the list of strings,

{ return g.Navn)}

Comments (0)

Leave a comment...

 
Got an account with one of these? Login here, or just enter your comment below.
Posterous-login    Connect    twitter