RaSor’s Blog

August 19, 2008

Cast a generic List. C# and VB.NET

Filed under: Generics, NET — rasor @ 11:01 am

Cast a derived list to a base list gives a compile error:
Cannot implicitly convert type ‘System.Collections.Generic.List’ to ‘System.Collections.Generic.List’ (more…)

August 13, 2008

Define a generic method (VB.NET)

Filed under: Generics, NET — rasor @ 6:22 am

A reminder of how the VB.NET syntax is for defining a generic method.
Just a sample. (more…)

Lookup with generic List and Dict (VB.NET)

Filed under: Generics, NET — rasor @ 5:49 am

When using a Dictionary the key have to be unique. If you want to lookup another property than the key, then you can use ToLookup(), if the property is unique.
http://msdn.microsoft.com/en-us/library/bb549211.aspx

You could also choose to convert the List to a Dict using ToDictionary() (more…)

Blog at WordPress.com.