title: Scope Resolution Operator in c# to access global variable?
body: <p>I have a Program in C++</p>
  
  <pre><code>int x=100; //Global declaration
  main()
  {
      int x=200;
      {
          int y;
          y=x;
          cout&lt;&lt;"Inner Block"&lt;&lt;endl;
          cout&lt;&lt;x&lt;&lt;endl;
          cout&lt;&lt;y&lt;&lt;endl
          cout&lt;&lt;::x&lt;&lt;endl;
      }
      cout&lt;&lt;"Outer Block"&lt;&lt;"\n";
      cout&lt;&lt;x&lt;&lt;"\n";
      cout&lt;&lt;::x;
  }
  </code></pre>
  
  <p>Output of this program is:
  Inner Block
  200
  200
  100
  Outer Block
  200
  100</p>
  
  <p>I want to try similar thing in c# but when I type ::x,i gives me error...
  Please help</p>
  
  <p>What I have tried is</p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Text;
  using System.Threading.Tasks;
  
  namespace CAScopeResolution_Operator
  {
      class Program
      {
          static int x = 100;
          static void Main(string[] args)
          {
              int x = 200;
              {
                  int y;
                  y = x;
                  Console.WriteLine("Inner Block");
                  Console.WriteLine(x);
                  Console.WriteLine(y);
                  Console.WriteLine(Program.x);  
              }
              Console.WriteLine("Outer Block");
              Console.WriteLine(x);
              Console.WriteLine(Program.x);
              Console.ReadLine(); 
          }
      }
  }
  </code></pre>
  
  <p>I have declared static x,but I dont think this is the solution to have similar code in c#... Please help</p>