Casting generic delegates to another type with interfaces
问题 (Using .NET 4.0) Ok, so I have private Dictionary<int, Action<IMyInterface, IMyInterface>> handler {get; set;} public void Foo<T, U>(Action<T, U> myAction) where T : IMyInterface where U : IMyInterface { // | This line Fails // V Action<IMyInterface, IMyInterface> anotherAction = myAction; handler.Add(someInt, anotherAction); } I'm trying to store the delegate in a generic collection, so I can pull it back out later to invoke it. How do I properly cast it? 回答1: The generic parameters to the