How to Get a Short Data Type Value as an Entry

advertisements

I need to get a short data type value as a input in C# Console Application. I heard that, its easy to get input in int, string,etc in C#. But I have to get a short data type value as a input. Please help me. Thanks !!


string input = Console.ReadLine();
short s;
if(short.TryParse(input, out s))
{
    //use s
}
else
{
    //invalid input
}