是否可以在C#中定义一个类
class GenericCollection<T> : SomeBaseCollection<T> where T : Delegate
Run Code Online (Sandbox Code Playgroud)
我无法为我的生活在.NET 3.5中完成这一切.我试过用
delegate, Delegate, Action<T> and Func<T, T>
在我看来,这应该是允许的某种方式.我正在尝试实现自己的EventQueue.
我最终只是这样做[原始近似注意你].
internal delegate void DWork();
class EventQueue {
private Queue<DWork> eventq;
}
Run Code Online (Sandbox Code Playgroud)
但是后来我失去了为不同类型的函数重用相同定义的能力.
思考?