I have a string array to be defined by user input and I need to convert the string array into a short array so I can use the values for calculations. I need to use an array because I will need to refer to all of the values collectively later. This is what I have:
string [] calIntake = new string[3];
calIntake [0] = Console.ReadLine ();
calIntake[1] = Console.ReadLine ();
calIntake[2] = Console.ReadLine ();
I have tried:
short[] calIntakeNum = Array.ConvertAll(calIntake.split(','), Short.Parse);
I get an error with this that says: "The type arguments for method 'System.Array.ConvertAll(TInput[], System.Converter)' cannot be inferred from the usage. Try specifying the type arguments explicitly.
Then I tried:
short[] calIntakeNum = Array.ConvertAll(calIntake.split(','), ne Converter<string, short>(Short.Parse));
and I get the same error. So how can I convert a string array based on user input into a short array?