0
试图编译这个代码,但如果声明咳嗽了一个错误:枚举错误:操作“==”不能应用于类型的“对象”的操作数和
Error 1 Operator '==' cannot be applied to operands of type 'object' and..
public enum ShoeType
{
soccer = 0,
jogging=1,
fitness=2
}
class Program
{
static void Main(string[] args)
{
string shoetype = "1";
if (Enum.Parse(typeof(ShoeType), shoetype) == ShoeType.jogging)
{
var test = "gotcha";
}
}
}