#718 – Scope
November 20, 2012 Leave a comment
In C#, every name has a scope. The scope of a name is the region of code in which you can refer to that name using just the unqualified name.
Here are some examples:
- The scope of a type defined within a namespace is all code also defined in that namespace
- The scope of a member declared in a class is the body of that class
- The scope of a parameter declared in a method is the body of that method
- The scope of a local variable is the method in which it is defined
- The scope of a local variable defined within a block is the body of that block