我有一个我想像枚举一样使用的结构:
public struct SQLDS_statementTypes
{
public static string Select = "Select",
Update = "Update", Insert = "Insert", Delete = "Delete";
}
Run Code Online (Sandbox Code Playgroud)
但它抛出一个错误: “运算符'=='不能应用于'SQLDS_statementTypes'和'string'类型的操作数”在这个语句中:
if (statement == SQLDS_statementTypes.Update)
Run Code Online (Sandbox Code Playgroud)
有没有办法解决这个问题?
c# ×1