method scope variable : Variable Scope « Language Basics « C# / C Sharp






method scope variable

 

using System;
class IncDecApp
{
    public static void Foo(int j)
    {
        Console.WriteLine("IncDecApp.Foo j = {0}", j);
    }
   
    static void Main(string[] args)
    {
        int i = 1;
   
        Console.WriteLine("Before Foo(i++) = {0}", i);
        Foo(i++);
        Console.WriteLine("After Foo(i++) = {0}", i);
   
        Console.WriteLine();
   
        Console.WriteLine("Before Foo(++i) = {0}", i);
        Foo(++i);
        Console.WriteLine("After Foo(++i) = {0}", i);
    }
}

 








Related examples in the same category

1.Class level Variable scopeClass level Variable scope
2.Scoping in C#.
3.Scope class demonstrates instance and local variable scopes.Scope class demonstrates instance and local variable scopes.
4.System maximums and minimums.