The Scope and Lifetime of Variables : Variable Scope « Language Basics « C# / CSharp Tutorial






  1. A block is begun with an opening curly brace and ended by a closing curly brace.
  2. A block defines a declaration space, or scope.
  3. Each time you start a new block, you are creating a new scope.
  4. Variables are created when their scope is entered and destroyed when their scope is left.
1.10.Variable Scope
1.10.1.The Scope and Lifetime of Variables
1.10.2.Block scope.
1.10.3.Lifetime of a variable.