Mega Code Archive

 
Categories / C# Tutorial / Language Basics
 

The Scope and Lifetime of Variables

A block is begun with an opening curly brace and ended by a closing curly brace. A block defines a declaration space, or scope. Each time you start a new block, you are creating a new scope. Variables are created when their scope is entered and destroyed when their scope is left.