To Create and sort array

To create and sort array

Arrays are declared using parentheses (in Visual Basic) or square braces (in C#) as
part of a variable declaration. As with the String type, System.Array provides members
for working with its contained data. The following code declares an array with some
initial data and then sorts the array:
' VB

' Declare and initialize an array.
Dim ar() As Integer = { 3, 1, 2 }
' Call a shared/static array method.
' Display the result.
Console.WriteLine("{0}, {1}, {2}", ar(0), ar(1), ar(2))
// C#
// Declare and initialize an array.
int[] ar = { 3, 1, 2 };
// Call a shared/static array method.
// Display the result.
Console.WriteLine("{0}, {1}, {2}", ar[0], ar[1], ar[2]);


Author: sugandha18 Jan 2011 Member Level: Gold   Points : 1

In C# there are 3 types of array single dimensional, multidimensional and jagged array.

//Declaration of multiple dimensional array
int[ , ] arr = new int[2,3];
int[ , ] arr = new int[2,3]{{1,2,3},{4,6,5}};

Jagged array means array of array.
//Declaration of Jagged array
int[][] arr = new int[2][];
It must be initialized procedurally

Author: chetan19 Jan 2011 Member Level: Silver   Points : 1

in vb .net there are different type f the array the array is a collection of the items or the data of the same type..
there are mainly two types of array one dimensional and the other is multi-dimensional
dim array_name[index or index,index] as type
there may be jagged array which can have a different rows with the different columns.
for ex:
dim i[4] as integer will store values from 0 to 4 means total five values of the type integer.

Author: SethuRaman10 Feb 2011 Member Level: Gold   Points : 1


Thanks all for posting valuable information about array

valuable if post more example with this .

Author: ketan Italiya26 Oct 2013 Member Level: Gold   Points : 2

Arrays are collections of data. A scalar variable can hold only one item at a time. Arrays can hold multiple items. These items are called elements of the array. Arrays store data of the same data type. Each element can be referred to by an index. Arrays are zero based. The index of the first element is zero. Arrays are reference types.

Arrays are used to store data of our applications. We declare arrays to be of a certain data type. We specify their length. And we initialize arrays with data. We have several methods for working with arrays. We can modify the elements, sort them, copy them or search for them.

int[] ages;
String[] names;
float[] weights;

  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name: