草庐IT

FooEventArgs

全部标签

c# - 我可以将泛型设为可选,默认为某个类吗?

我的问题与Isthereareasonableapproachto"default"typeparametersinC#Generics?有关,但使用内部泛型类这种方法不起作用。给定这样的代码:usingSystem;publicclassFooEventArgs:EventArgs{//...Tpropertiesandaconstructor}publicclassFoo{publicdelegatevoidEventHandler(objectsender,FooEventArgse);publiceventEventHandler>Changed}像这样使用它:publiccl

c# - 我可以将泛型设为可选,默认为某个类吗?

我的问题与Isthereareasonableapproachto"default"typeparametersinC#Generics?有关,但使用内部泛型类这种方法不起作用。给定这样的代码:usingSystem;publicclassFooEventArgs:EventArgs{//...Tpropertiesandaconstructor}publicclassFoo{publicdelegatevoidEventHandler(objectsender,FooEventArgse);publiceventEventHandler>Changed}像这样使用它:publiccl