[Solved] How can I use the same name for two or more different variables in a single C# function? [closed]

You can make the scopes non-overlapping using braces: switch (something) { case 1: { int Number; } break; case 2: { float Number; } break; } Going out of scope is the only way a variable name is “deleted” in the sense you are talking about. Notably and unlike some other languages, C# doesn’t allow … Read more