I have a struct that I am trying to use like an enum:
public struct SQLDS_statementTypes
{
public static string Select = "Select",
Update = "Update", Insert = "Insert", Delete = "Delete";
}
But it throw an error: “Operator ‘==’ cannot be applied to operands of type ‘SQLDS_statementTypes’ and ‘string'” on this statement:
if (statement == SQLDS_statementTypes.Update)
Is there anyway to solve this?
Someone was looking for something that seems more or less what you’re looking for a while back (I can’t be bothered to find a link) and I wrote this at the time. You may want to change the class name to be more inline with what you want. I hope that the configurations for adding/removing values are straightforward, if not I can elaborate.