CSharp examples for Custom Type:static
Using Local Versus Class Variables
using System;//ww w.j a v a 2s .co m class loco { public int x; public void count_x() { int x; Console.WriteLine("In count_x function. Printing X values..."); for ( x = 0; x <= 10; x++) { Console.Write("{0} - ", x); } Console.WriteLine("\nAt the end of count_x function. x = {0}", x); } } class CircleApp { public static void Main() { loco Locals = new loco(); int x = 999; Locals.x = 555; Console.WriteLine("\nIn Main(), x = {0}", x); Console.WriteLine("Locals.x = {0}", Locals.x); Console.WriteLine("Calling Function"); Locals.count_x(); Console.WriteLine("\nBack From Function"); Console.WriteLine("Locals.x = {0}", Locals.x); Console.WriteLine("In Main(), x = {0}", x); } }