Answer the question
In order to leave comments, you need to log in
Why from try catch, switch does not see the variable?
Why from try catch, switch does not see the variable?
Answer the question
In order to leave comments, you need to log in
Because curly braces in C# limit the scope of variables.
If you want the Number1 variable to be visible outside of the try block, you need to take it up a level.
Approximately like this:
double Number1 = 0;
try {
// Тут пы инициализируем переменную
} catch {
//Как-то обрабатываем возможную ошибку
}
// Тут мы можем использовать Number1
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question