I would like to pass an argument to a method.
public void Foo(string range)
{
}
How can I restrict or limit the string passed to this method? Like only High/Medium/Low can be chosen when call Foo
, not any other string?
You can pass as enum, instead of string.
public void Foo(Range range)
{
}
enum Range {
High,
Medium,
Low
}