Saturday, December 22, 2012

How to create one-Dimensional array in c#.net


This post will describe the basic concepts of chsarp which is array.
String [] str=new String[4];
In the above i have created two single dimensional array for integers and string.Here the str array size is 5.So we can create five elements from str[0] ...str[4]

Initialization of array:
int[] x=new int[] {1,2,3,4,5};
while initialization of array size is not recommended

Example:A program to print the default values of an array
Place a submit button on a form and add the below code
Button click event
{
int[] x= new int[2];
for(int i=0;i<x.lenght;i++)
{
MessageBox. Show(x[i]+..);
}
}

Post a Comment

Bel