S
Sadeq
Enums are useful when we want to constrain the user to choose from a
specified number of predifined valuse. But they only accept integral
types as their underlying type.
I encountered a case in which I have to constrain the use to choose
from a specified number of predifined int arrays. For example:
readonly int[] choice1 ={ 1, 2, 840, 113549, 1, 1, 2 };
readonly int[] choice2 ={ 1, 2, 840, 113549, 1, 1, 4 };
readonly int[] choice3 ={ 1, 2, 840, 113549, 1, 1, 5 };
I want to define a function which only accepts these 3 arrays as its
input. Is there a way to define a signature for that function (WITHOUT
declaring its argument as int[]) to force the user to enter the correct
value at compile time?
specified number of predifined valuse. But they only accept integral
types as their underlying type.
I encountered a case in which I have to constrain the use to choose
from a specified number of predifined int arrays. For example:
readonly int[] choice1 ={ 1, 2, 840, 113549, 1, 1, 2 };
readonly int[] choice2 ={ 1, 2, 840, 113549, 1, 1, 4 };
readonly int[] choice3 ={ 1, 2, 840, 113549, 1, 1, 5 };
I want to define a function which only accepts these 3 arrays as its
input. Is there a way to define a signature for that function (WITHOUT
declaring its argument as int[]) to force the user to enter the correct
value at compile time?