4
有人给我一个类型t。有什么办法可以检查一个类型是枚举类型吗?
我想知道如果这种类型是枚举或不。
public bool IsEnumeration(Type t)
{
// Mystery Code.
throw new NotImplementedException();
}
public void IsEnumerationChecker()
{
Assert.IsTrue(IsEnumeration(typeof(Color)));
Assert.IsFalse(IsEnumeration(typeof(float)));
}
谢谢,我会记住它。 – user420667 2011-01-20 19:10:24
@Downvoter:关心评论? – 2011-01-20 19:16:48