int x = 3; someControl.Invoke(new MethodInvoker(() => { double y = Math.Cos(x); }));
//double z = Math.Cos(x); <-- if I uncomment this line, the "assigned value not used" goes away.
As it stands with the code above, the "= 3" is grayed out and if I hover over it it says "Value assigned is not used in any execution path". Clearly the assigned value of 3 is being used, and if I remove the initialization (as Resharper is recommending), my code will be broken.
EDIT: Please note that I'm not suggesting the code I've provided is particularly useful or well-written. My goal was to provide the simplest possible example of this that I've seen.
Please provide an example
--
Eugene Pasynkov
ReSharper Technical Lead
JetBrains, Inc.
http://www.jetbrains.com
"Develop with pleasure!"
"suedeuno" <no_reply@jetbrains.com> wrote in message
news:14459075.83781226069811404.JavaMail.jive@app4.labs.intellij.net...
Here's an example:
int x = 3;
someControl.Invoke(new MethodInvoker(() => { double y = Math.Cos(x); }));
//double z = Math.Cos(x); <-- if I uncomment this line, the "assigned value not used" goes away.
As it stands with the code above, the "= 3" is grayed out and if I hover over it it says "Value assigned is not used in any execution path". Clearly the assigned value of 3 is being used, and if I remove the initialization (as Resharper is recommending), my code will be broken.
EDIT: Please note that I'm not suggesting the code I've provided is particularly useful or well-written. My goal was to provide the simplest possible example of this that I've seen.