【发布时间】:2012-07-06 20:30:58
【问题描述】:
enum MyEnum
{
type1,
type2,
type3
}
public void MyMethod<T>()
{
...
}
如何在枚举上进行 forach 以在每个枚举上触发 MyMethod<T>?
我尝试一下
foreach (MyEnum type in Enum.GetValues(typeof(MyEnum)))
{...}
但仍然不知道如何在 foreach 中使用这个type
MyMethod<T> 为 T
【问题讨论】:
-
你想做什么?
标签: c# templates .net-4.0 enums