public static double TemperatureRequest(TypeOfTemperature typeOfTemperature) { double dbl; ShowMsg(typeOfTemperature); while (!double.TryParse(Console.ReadLine().Replace('.', ','), out dbl)) { ShowMsg(typeOfTemperature, true); } return(dbl); }
public static void ShowMsg(TypeOfTemperature typeOfTemperature, bool isRepeat = false) { StringBuilder builder = new StringBuilder("Please, enter ", 100); if (isRepeat) { builder.Append("correct "); } builder.Append($"{typeOfTemperature} temperature: "); Console.WriteLine(builder); }