I want to have a string which is limited to 4-5 values (ex: "Insert", "update", "delete", "check"
) but no other values expect the above can be assigned to the string (similar to true
and false
in bool
)
but I want to know if it is possible without checking if the string is one of those values like so:
//not what i want
switch(str){
case "update":
isgoodvul=true;
break;
case "delete":
//(and so on).....
}
but more like
//what i want
string limited="hello world";
//error;
string limited="update";
//not error;
string any_other_string_name_exept_limited="hello world";
//not error;
string any_other_string_name_exept_limited="update";
//not error;