Did you know in .net #2 (Limit the scope of variables)

Tags: c#, asp net, MVC

Limit the life and the scope of variables by using { } brackets.

string str1 = “1”;

{string str2 = “3”; Console.Write(str2);}

Console.Write(str2);

str2 only lives within the brackets

Add a Comment