If I do:
string x = "Whatever";
Is that different in ANY way (other than the obvious syntax) to having it split in two lines?
string x;
x = "Whatever";
Is the first way just pure sugar?
I ask because I had a loop:
foreach(string s in MyListOfStrings)
{
string x = Method(s);
}
And wondered if and why this was better / faster / cleaner:
string x;
foreach(string s in MyListOfStrings)
{
x = Method(s);
}
I'm sure this has already been asked and pored over so if anyone can just point me to a good article / doc that'd be appreciated.