我是新来枚举。帮助使用枚举和Enum.Parse
我有了这个枚举:
public enum Categories
{
Animals,
Animations,
Accessories,
Apearance,
Clothing,
Gadgets,
Land,
Scripts,
Vehicles,
Weapons,
Other
}
然后,我有这个变量:private Categories Category;
我试图分析用户输入(串),这样Category
将等于正确的枚举。
this.Category = Enum.Parse(Categories ,cat);
我得到这个错误:
'Product.Categories' is a 'type' but is used like a 'variable'
我希望你明白我想说什么。
'this.Category'确实被声明为这样:) – BoltClock 2011-05-05 16:52:05