[351] - Local Delegate Vairable Not Initialised Error Follow
The following code give an error that the local variable 'harvest' is not
initialised. Am I missing something or is this an incorrect error?
// This is sitting inside a windows form.
public void Foo()
{
List result = new List();
Action]]> harvest =
delegate(Control obj)
{
if (Bar(obj))
{
result.Add(obj);
}
else
{
foreach (Control child in obj.Controls)
{
// Local variable 'harvest' might not be initialised before
accessing.
harvest(child);
}
}
};
harvest(this);
}
Thanks
Sean
Please sign in to leave a comment.
You example is not compilable
--
Eugene Pasynkov
Developer
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"
"Sean Kearon" <no@spam.org> wrote in message
news:40d4dfe5123178c9313480e0cb76@news.jetbrains.com...
>
>
>
>
>
>
Thanks Eugene.....this was also answered in the EAP group, but I missed the
part about non-compilation and assumed that the error highlight was due to
R#. Sorry for the time waste!
Cheers
Sean