Create a new EventArgs class, for example:
public class ListEventArgs : EventArgs { public List<string> Data { get; set; } public ListEventArgs(List<string> data) { Data = data; } }
And make your event as follows:
public event EventHandler<ListEventArgs> NewFileAdded;
Add a shooting method:
protected void OnNewFileAdded(List<string> data) { var localCopy = NewFileAdded; if (localCopy != null) { localCopy(this, new ListEventArgs(data)); } }
And when you want to handle this event:
myObj.NewFileAdded += new EventHandler<ListEventArgs>(myObj_NewFileAdded);
The handler method will look like this:
public void myObj_NewFileAdded(object sender, ListEventArgs e) {
Mohamed Sakher Sawan Dec 27 '12 at 17:10 2012-12-27 17:10
source share