VB.net program to create a 2-D rectangular array of Tuple

Rajnilari2015
Posted by Rajnilari2015 under VB.NET category on | Points: 40 | Views : 277
Dim int2DArray As Tuple(Of Integer, Integer)(,) = New Tuple(Of Integer, Integer)(1, 2) {}
'creating an array of capacity 2,3
'Pushing data to the 2D Rectangular Array
For row As Integer = 0 To 1
For col As Integer = 0 To 2
int2DArray(row, col) = Tuple.Create((row + 1), (col + 1))
Next
Next

'Accessing data from the 2D Rectangular Array
For row As Integer = 0 To 1
For col As Integer = 0 To 2
Console.WriteLine("Element at row {row} is {int2DArray[row, col].Item1} and col {col} is {int2DArray[row, col].Item2} ")
Next
Next

Comments or Responses

Login to post response