www.borneoexchanger.com

Thursday, September 4, 2008

Initializing a jagged array, one in which the length of each array differs

Imports System
Imports System.Data
Imports System.Collections

public class MainClass
Shared Sub Main()
Dim c()() As Integer = {New Integer() {1, 2}, New Integer() {1, 2, 3}}

c(1) = New Integer() {4, 5}
Console.WriteLine(c(1)(1))
c(1) = System.Array.CreateInstance(GetType(System.Int32), 10)
Console.WriteLine(c(1)(1))
Dim d() As Integer = {6, 7}
c(1) = d
Console.WriteLine(c(1)(1))
End Sub
End Class

No comments: