Categories: VB.Net Posted by Christoph on 9/16/2008 3:42 PM | Comments (0)

Auch mit VB.Net kann man Generische Kollektionen "on the fly", also direkt bei der Deklaration befüllen und auch direkt in ein Dictionary umwandeln:

'--"Normal" strong Typed List
Dim Ps As New List(Of Product)

'--Add Product :-o
Ps.Add(New Product With {.ID = "123", .Headline = "Test"})

'--Convert to Dictionary (see KeySelector!)
Dim Dict = Ps.ToDictionary(Function(c) c.ID)

gefunden hier:

http://blogs.msdn.com/timng/archive/2007/12/12/using-the-todictionary-extension-method.aspx

Comments