Skip to content

Arrays

syed

Asked May 24, 2007, 9:34 PM EDT2 answers
Share
LinkedInX
i get values from sqldatareader and store it in array
if i dont initialize array size it will not work and i will be not knowing how much size i have to initialize

how to store values in string array

is my syntax below is correct

{

// Put user code to initialize the page here

int i=0;

i=10;

string[] strarr;if(i==10)
Code
{
strarr="firstvalue;
}
i=20;
if(i==20)
Code
{
strarr="secondvalue";
}
i=30;
if(i==20)
Code
{
strarr="thirdvalue";
}
i=40;
if(i==20)
Code
{
strarr="fourth value";
}
foreach(string str in strarr)
Code
{
Response.Write(str+"
");
}
}

 

so finally my code should display

firstvalue

secondvalue

thirdvalue

fourthvalue

2 Answers

Know the answer? Post it. Somebody with the same question will find it here.