Reputation: 67283
In the following code, I get the following warning:
The variable 'Result' is assigned but its value is never used
bool Result;
base.ExecuteTest(delegate(Selenium.ISelenium sel1)
{
return Result = false;
});
Furthermore, in the following code:
for (int i = 0; i <= ClientSiteCnt; )
{
return (Result = testcaseDel.Invoke());
}
The delegate signature is
public delegate bool TestCaseDelegate(Selenium.ISelenium sel);
How do I add the parameter (the delegate's parameter) in the .Invoke() method?
Upvotes: 0
Views: 156
Reputation: 7693
about add parameter to Invoke method
you will just write it as
TestCaseDelegate testCaseDelegate =new TestCaseDelegate([method Name]);
testCaseDelegate .Invoke([parameter of type Selenium.ISelenium]);
Upvotes: 1
Reputation: 52503
You get this message because you only assign a value to Result, but never use it.
What the compiler tries to tell you is: Why do you declare Result, assign values to it, but never use it?
Since you never use Result, your code samples will function exactly the same when you use:
base.ExecuteTest(delegate(Selenium.ISelenium sel1)
{
return false;
});
and
// for (int i = 0; i <= ClientSiteCnt; )
// {
return testcaseDel.Invoke();
// }
Upvotes: 0