I have a function, call it Func1 and it containsFunc2 and an event handler.
Now, what I would like to get is not letfunction (Func1) to return the value until Func2 lights up and processes the event.
Basically Func1 has a string as the return value, and the string value is set inside the event handler. So I need to wait for the event to be processed, and then return the value.
Code example
public static string Fun1 ()
{
string stringToReturn = String.Empty;
Func2();
example.MyEvent += (object sender, WebBrowserDocumentCompletedEventArgs e) =>
{
stringToReturn = "example";
};
return stringToReturn;
}
source
share