I am aware I can do this:
WebClient client = new WebClient();
client.UploadStringCompleted += delegate(object sender, UploadStringCompletedEventArgs e)
{
//handle event
};
client.UploadStringAsync(myURI, "POST", "some_data");
But is there a way I can pass an inline delegate as an argument? Something like this:
DoRequest("some_data",
delegate(object sender, UploadStringCompletedEventArgs e)
{
//handle event
});
public void DoRequest(string data, UploadStringCompletedEventHandler event)
{
WebClient client = new WebClient();
client.UploadStringCompleted += event;
client.UploadStringAsync(myURI, "POST", data);
}