2005-06-29 Jonathan Chambers <jonathan.chambers@ansys.com>
[mcs.git] / tools / cilc / Test.cs
blob893aff9697adca82613c96351c926344427d6d1f
1 namespace Demo
3 using System;
5 public interface INumbered
7 void Increment ();
10 public class Counter : INumbered
12 int counter;
14 public void Increment ()
16 counter++;
17 Console.WriteLine ("Instance method invoked: Value incremented, making it " + counter);
20 public void AddNumber (int num)
22 counter += num;
23 Console.WriteLine ("Instance method with an argument invoked: " + num + " added to value, making it " + counter);
27 public class Test
29 string title;
30 int counter;
32 public static void StaticMethod ()
34 Console.WriteLine ("Static method invoked");
37 public Test ()
39 title = "";
40 counter = 0;
42 Console.WriteLine ("Class constructor invoked: Value initialised, making it " + counter);
45 public void Increment ()
47 counter++;
48 Console.WriteLine ("Instance method invoked: Value incremented, making it " + counter);
51 public void AddNumber (int num)
53 counter += num;
54 Console.WriteLine ("Instance method with an argument invoked: " + num + " added to value, making it " + counter);
57 public double GetDoubleValue ()
59 return (double)counter/2;
62 public int GetValue ()
64 return counter;
67 public static Drink PickDrink ()
69 return Drink.Water;
72 public string Title
74 get { return title; }
75 set { title = value; }
78 public void Echo (string arg1string)
80 Console.WriteLine ("string: " + arg1string);
83 public string MakeUpper (string arg1string)
85 return arg1string.ToUpper ();
88 public void Method4 (string arg1string, int arg2int)
90 Console.WriteLine (arg1string + arg2int.ToString ());
93 public void GTypeGTypeGType ()
95 Console.WriteLine ("c# method with an unusual name invoked");
99 public enum Drink
101 Water,
102 Juice,
103 Cola