Mega Code Archive

 
Categories / VB.Net Tutorial / Collections
 

Display the contents of a single-dimension array

Public Class Tester     Public Shared Sub Main         Dim sourceArray() As Integer = {1, 2, 3}         Dim result As New System.Text.StringBuilder         Dim counter As Integer         result.Append("{")         For counter = 0 To sourceArray.Length - 1             result.Append(sourceArray(counter).ToString())             If (counter < (sourceArray.Length - 1)) Then result.Append(",")         Next counter         result.Append("}")         Console.WriteLine(result.ToString())              End Sub End Class {1,2,3}