K
K
Kirill Romanov2014-10-19 17:14:48
Mono
Kirill Romanov, 2014-10-19 17:14:48

Why is an exception thrown in mono?

I'm starting to learn C #, there is such a piece of code. When entering the correct string in Windows, everything is fine, but when I run it through mono under the line, a System.FormatException is thrown.
I enter the same line ("January 15, 1995")

while (true)
{
    Console.WriteLine("Введите дату рождения:");
    try
    {
        birthday = Convert.ToDateTime(Console.ReadLine());
        break;
    }
    catch (System.FormatException)
    {
        Continue.WrongInput();
    }
}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Stanislav Silin, 2014-10-19
@byme

Perhaps you have a different date format configured in the line or a different region is selected.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question