Tips, Tricks, Thoughts & Ideas
 

Generics Declaration in VB.NET vs C# 

Friday, October 16, 2009 1:39:31 AM

There are many differences between VB.NET and C#.  There are wide and sweeping differences in processing, code objects and delivered features.  However, many of the common disparities can be quickly figured out as they are syntactical. One such difference that isn't so easy to figure out simply by "typing" is the declaration of Generics.  The following example is a quick example of the declaration of a Generic List Collection in both VB.NET and C#:

VB.NET:

Dim myList As New List(Of Integer)
myList.Add(10)

C#:

List<int> myList = new List<int>();
myList.Add(10);


 



Comments are closed on this post.
Printable View © 2001 - 2012 JBC Digital, Inc. Site and Design by JBCDigital, Inc.