K
kellyatdentrix
Suppose that I just want to count the elements in a collection, so I do
this:
int i = 0;
foreach (MyElement el in MyCollection)
{
i++;
}
return i;
Is there any way in the 2003 compiler to avoid the warning:
warning CS0168: The variable 'el' is declared but never used?
I don't want to turn off the warning (can't anyway in VS 2003) I want
to fix the code without doing something wasteful...
Thanks!
And yes, I do know that you could just get the length of the
collection... my real example is a bit more complex than that presented
here.
-Kelly
this:
int i = 0;
foreach (MyElement el in MyCollection)
{
i++;
}
return i;
Is there any way in the 2003 compiler to avoid the warning:
warning CS0168: The variable 'el' is declared but never used?
I don't want to turn off the warning (can't anyway in VS 2003) I want
to fix the code without doing something wasteful...
Thanks!
And yes, I do know that you could just get the length of the
collection... my real example is a bit more complex than that presented
here.
-Kelly