OperatorConverter.ToOperator(int) - YiZhang-Paul/Mock_Up_Calculator GitHub Wiki
Namespace: ConverterClassLibrary
Description: Maps a numeric value to operator.
Parameters | Description |
---|---|
value<int> | value to convert |
Returns | Description |
---|---|
string | a valid operator or null when invalid value is passed |
Examples:
string[] operators = { "+", "-", "!" };
var converter = new OperatorConverter(operators, null);
Console.WriteLine(converter.ToOperator(0)); //"+"
Console.WriteLine(converter.ToOperator(1)); //"-"
Console.WriteLine(converter.ToOperator(2)); //"!"
Console.WriteLine(converter.ToOperator(3)); //null