#718 – Scope

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
Advertisements

About Sean
Software developer in the Twin Cities area, passionate about .NET technologies. Equally passionate about my own personal projects related to family history and preservation of family stories and photos.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: