In my post _place_holder;More Tricks w/ C# Generics, I re-posted Don Box’s sample that demonstrated the use of the where clause in a generic definition.
Don’s code was:
public delegate void EventHander<S, T>(S sender, T args) where T : EventArgs;
Brett _place_holder;Knights asked in the comments of my post what the difference is between Don’s code and this:
public delegate void EventHander<S>(S sender, EventArgs args); _place_holder; _place_holder;
I’m not 100% sure of this, but based on my experience with C++ templates I would suggest that there is _place_holder;a significant difference between Brett’s example and Don’s. In the former example, you are saying that T should be derived from EventArgs, but within your method T is still “untyped”. In other words you can access any public method on T, not just those defined in EventArgs.
In Brett’s example you would only be able to call the public methods defined in the EventArg class.
Am I right here? Anyone who actually has Whidbey care to comment?