Declare a generic type : Generic Class « Generics « VB.Net






Declare a generic type

  

Public Class Car
End Class

Module Program
  Sub Main()
    Dim myCars As New List(Of Car)
    myCars.Add(New Car())
    Console.WriteLine(myCars.Count)
    Dim MyInts As New List(Of Integer)
    MyInts.Add(50)
    Dim val As Integer = MyInts.Count
    Console.WriteLine(MyInts.Count)
  End Sub
End Module

   
    
  








Related examples in the same category

1.Generic List stores Generic ClassGeneric List stores Generic Class
2.Generic Class DemoGeneric Class Demo
3.Generic Point Structure