Initialize array in C#.Net

Results 1 to 2 of 2

Thread: Initialize array in C#.Net

  1. #1
    Join Date
    Dec 1969

    Default Initialize array in C#.Net

    Hi..I am new to C#.I would like to initialize an array in i write it in this manner?<BR><BR>&#060;coding&#062;<BR> for (i=0;i&#060;=9;i++)<BR> {<BR> imp_arr[i] = "";<BR> <BR> }<BR>&#060;/coding&#062;

  2. #2
    Join Date
    Dec 1969

    Default RE: Initialize array in C#.Net

    //Declaration<BR>string[] strVariable;<BR>//Initialize<BR>strVariable = new string[10]; //10 is the number of elements u<BR> //want to have in the array<BR>//Dynamic Declaration and Initialiazation<BR>int NoofElements = 10;<BR>string[] strVariable = new string[NoofElements];<BR>//You can access the elements<BR>for(int i=0;i&#060;NoofElements;i++)<BR> strVariable[i]

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts