//C# Static Variabelen Procedures en Functies public class Example1 { void Main() { this.Test1(); this.Test1(); this.Test1(); this.Test2(); this.Test2(); this.Test2(); Console.ReadLine(); } void Test1() { int x; this.x += new System.EventHandler(1); Console.WriteLine(x); } void Test2() { int x = 10; this.x += new System.EventHandler(1); Console.WriteLine(x); } } public class Example2 { void Main() { this.Test(); this.Test(); this.Test(); Console.ReadLine(); } void Test() { bool firstExecution = true; if (firstExecution) { Console.WriteLine("First execution of Test."); firstExecution = false; } else { Console.WriteLine("Not the first execution of Test."); } } } public class Exercise1Task { void Main() { this.Test1(); this.Test1(); Console.ReadLine(); } void Test1() { int t1 = 10; this.t1 += new System.EventHandler(1); this.Test2(t1); this.Test2(t1); } void Test2(int t2) { int t3 = 20; this.t3 += new System.EventHandler(t2); Console.WriteLine(t3); } } //Bezoek www.vbvoorbeelden.be voor meer C# voorbeelden. //Copyright - De Wolf / vbvoorbeelden - 2003-2010 - Alle rechten voorbehouden.