2007-03-21 Mike Kestner <mkestner@novell.com>
[mono.git] / mcs / tools / cilc / Test.cs
1 namespace Demo
2 {
3         using System;
4
5         public interface INumbered
6         {
7                 void Increment ();
8         }
9
10         public class Counter : INumbered
11         {
12                 int counter;
13
14                 public void Increment ()
15                 {
16                         counter++;
17                         Console.WriteLine ("Instance method invoked: Value incremented, making it " + counter);
18                 }
19
20                 public void AddNumber (int num)
21                 {
22                         counter += num;
23                         Console.WriteLine ("Instance method with an argument invoked: " + num + " added to value, making it " + counter);
24                 }
25         }
26
27         public class Test
28         {
29                 string title;
30                 int counter;
31
32                 public static void StaticMethod ()
33                 {
34                         Console.WriteLine ("Static method invoked");
35                 }
36
37                 public Test ()
38                 {
39                         title = "";
40                         counter = 0;
41
42                         Console.WriteLine ("Class constructor invoked: Value initialised, making it " + counter);
43                 }
44
45                 public void Increment ()
46                 {
47                         counter++;
48                         Console.WriteLine ("Instance method invoked: Value incremented, making it " + counter);
49                 }
50
51                 public void AddNumber (int num)
52                 {
53                         counter += num;
54                         Console.WriteLine ("Instance method with an argument invoked: " + num + " added to value, making it " + counter);
55                 }
56
57                 public double GetDoubleValue ()
58                 {
59                         return (double)counter/2;
60                 }
61
62                 public int GetValue ()
63                 {
64                         return counter;
65                 }
66
67                 public static Drink PickDrink ()
68                 {
69                         return Drink.Water;
70                 }
71
72                 public string Title
73                 {
74                         get { return title; }
75                         set { title = value; }
76                 }
77
78                 public void Echo (string arg1string)
79                 {
80                         Console.WriteLine ("string: " + arg1string);
81                 }
82
83                 public string MakeUpper (string arg1string)
84                 {
85                         return arg1string.ToUpper ();
86                 }
87
88                 public void Method4 (string arg1string, int arg2int)
89                 {
90                         Console.WriteLine (arg1string + arg2int.ToString ());
91                 }
92
93                 public void GTypeGTypeGType ()
94                 {
95                         Console.WriteLine ("c# method with an unusual name invoked");
96                 }
97         }
98
99         public enum Drink
100         {
101                 Water,
102                 Juice,
103                 Cola
104         }
105 }