Populate Object array : Array Object « Collections « VB.Net Tutorial






Option Strict On
 Imports System

 Public Class Employee
     Private empID As Integer
     Public Sub New(ByVal empID As Integer)
         Me.empID = empID
     End Sub
 End Class

 Class Tester
     Shared Sub Main()
         Dim intArray As Integer()
         Dim empArray As Employee()
         intArray = New Integer(5) {}
         empArray = New Employee(3) {}

         Dim i As Integer

         For i = 0 To empArray.Length - 1
             empArray(i) = New Employee(i + 5)
             i = i + 1
         Next
     End Sub
 End Class








8.5.Array Object
8.5.1.Object array
8.5.2.Populate Object array
8.5.3.Sort a custom object array