Class level Variable scope : Variable Scope : Language Basics C# Source Code


Custom Search

C# Source Code » Language Basics » Variable Scope »

 

Class level Variable scope









    

/*
C# Programming Tips & Techniques
by Charles Wright, Kris Jamsa

Publisher: Osborne/McGraw-Hill (December 28, 2001)
ISBN: 0072193794
*/

namespace nsScope
{
    using System;
    public class Scope
    {
        int Var = 42;
        static public void Main ()
        {
            Scope cls = new Scope();
            int Var = 23;
            Console.WriteLine ("Class variable = " + cls.Var);
            Console.WriteLine ("Function variable = " + Var);
        }
    }
}

           
       
    
   
  
   







HTML code for linking to this page:

Follow Navioo On Twitter

C# Source Code

 Navioo Language Basics
» Variable Scope