草庐IT

FirstEnumType

全部标签

C# 通用枚举转换为特定枚举

我有接受"T"类型的通用方法,这是枚举器。在方法内部,我必须调用辅助类方法,方法名称取决于枚举器的类型。publicMeth(Ttype){if(typeof(T)==typeof(FirstEnumType)){FirstEnumTypet=???//IsomehowneedtoconvertTtypetoFirstEnumTypethis.helperFirstCalcBll(t);}else{SecondEnumTypet=???//IsomehowneedtoconvertTtypetoSecondEnumTypethis.helperSecondCalcBll(t);}}