Quote:
Originally Posted by arun_babu_a
In page 116
Code:
string mystring="A string";
char [] myChars=myString.ToCharArray();
In the next line
Code:
foreach(char characters in myString)
{
console.writeline("{0}",character);
}
In foreach loop how myString comes,is it myChars
|
What do you mean with the myString comes as myChars? How does the foreach loop relate with the myChars variable declared earlier? There's no relation to that, the variable myChars is not used in the foreach statement.
And you should get an compile-time error as first a variable characters is declared with the foreach loop, and then the variable character is used.