Question: Visual Studio 2008, C# 3.0.

I have a method below which calls an event handler. I would like to pass the two arguments received by the method to the event handler.

I would like to do something like this:

```
wc.DownloadDataCompleted += wc.DownloadedDataCompleted(strtitle, placeid);

```

Is this even possible, if yes, how would I go about doing it ?

Code Snippet:

```
public void downloadphoto(string struri,string strtitle,string placeid)
{
    using (WebClient wc = new WebClient())
    {
        wc.DownloadDataCompleted += wc_DownloadDataCompleted;
        wc.DownloadDataAsync(new Uri(struri));
    }
}

```

Answer: 
`DownloadDataAsync` has an overload which takes an object:

```
DownloadDataAsync(uri, object)

```

That object can be any arbitrary thing you want that gets passed into the `DownloadDataCompleted handler`:

```
public void downloadphoto(string struri,string strtitle,string placeid)
{
    using (WebClient wc = new WebClient())
    {
        string[] data = new string[2] { strtitle, placeid };
        wc.DownloadDataCompleted += wc_DownloadDataCompleted;
        wc.DownloadDataAsync(new Uri(struri), data);
    }
}

void wc_DownloadDataCompleted(object sender, DownloadDataCompletedEventArgs e)
{
    string[] data = (string[])e.UserToken;
    string strtitle = data[0];
    string placeid = data[1];
}

```
You could create a private class and place the handler in there. E.g.

```
    public void downloadphoto(string struri, string strtitle, string placeid)
    {
        using (WebClient wc = new WebClient())
        {
            wcHandler handler = new wcHandler() { Strtitle = strtitle, Placeid = placeid };
            wc.DownloadDataCompleted += handler.wc_DownloadDataCompleted;
            wc.DownloadDataAsync(new Uri(struri));
        }

    }

    private class wcHandler
    {
        public string Strtitle { get; set; }
        public string Placeid { get; set; }

        public void wc_DownloadDataCompleted(object sender, DownloadDataCompletedEventArgs e)
        {
            // Do Stuff
        }
    }

```

Although, given the elegance of Jon's answer would probably use that!