views:

212

answers:

1

I want to have a generic event that I can fire that will take a custom eventArgs> e

Here is my code so far

public event resultsEventHandler<T> returnResults;

public delegate void resultsEventHandler<T>(object sender, resultEventArgs<ObservableEntityCollection<T>> e);


protected virtual void OnreturnResults(resultEventArgs<ObservableEntityCollection<T>> > e)
{
    if (returnResults != null)
    {
        returnResults<T>(this, e);
    }
}

public class resultEventArgs<ObservableEntityCollection<T>> : EventArgs
{
    private readonly ObservableEntityCollection<T> _results;
    public resultEventArgs(ObservableEntityCollection<T>  results)
    {
        this._results = results;
    }

    public ObservableEntityCollection<T>>  queryResult 
    { 
        get { return _results; } 
    }
}
+2  A: 

Not sure of the question but

public class resultEventArgs<ObservableEntityCollection<T>> : EventArgs

should be

public class resultEventArgs<T> : EventArgs
pjbelf
yeah, agreed with that, in one incarnation of my problem it was. I posted the highly messed up code rather than my first attempt.
DavidA