How to access VIP in the proxy_OpenReadCompleted method?
void method1()
{
String VIP = "test";
WebClient proxy = new WebClient();
proxy.OpenReadCompleted += new OpenReadCompletedEventHandler(proxy_OpenReadCompleted);
String urlStr = "someurl/lookup?q=" + keyEntityName + "&fme=1&edo=1&edi=1";
}
void proxy_OpenReadCompleted(object sender, OpenReadCompletedEventArgs e)
{
}
There are two approaches to this. First is to pass the string as the second parameter in the
OpenReadAsynccall, this parameter becomes the value of theUserStateproperty of the event args.Another approach is to access the variable directly using a closure:-