Can I make this:if (oneFour == 1 || oneFour == 2 || oneFour == 3 || oneFour == 4)shorter, especially if I'm gonna need a wider range of integers?Do I need to use a string _warning twice like I did?static string _warning = Please, enter a number from 1 to 4!;static int oneToFour(){    int oneFour = 0;    bool isError = true;    while (isError)    {        try        {            oneFour = Convert.ToInt32(Console.ReadLine());            if (oneFour == 1 || oneFour == 2 || oneFour == 3 || oneFour == 4)                isError = false;            else                Console.WriteLine(_warning);        }        catch { Console.WriteLine(_warning); }    }    return oneFour;}
Method that returns an integer chosen by user
c#;integer
You should start using comparison operators,for a range from 1 to 4, use this:if (oneFour >= 1 && oneFour <= 4)This reads naturally as if variable is more than or equal to 1 and variable is less then or equal to 4, which is the same thing as if variable is in range 1 to 4.Other improvements:Instead of setting the isError value, you can return oneFour; directly.Using the above advice, you can change your loop to while (true), eliminating your isError totally.Using the above advice, you can make the scope for the oneFour variable smaller, which is a good thing (when possible).Braces. Always use braces.Resulting code will look something like this:static int oneToFour(){    while (true)    {        try        {            int oneFour = Convert.ToInt32(Console.ReadLine());            if (oneFour == 1 || oneFour == 2 || oneFour == 3 || oneFour == 4)            {                return oneFour;            }            else            {                Console.WriteLine(_warning);            }        }        catch { Console.WriteLine(_warning); }    }}