Merge pull request #5714 from alexischr/update_bockbuild
[mono.git] / mono / tests / indexer.cs
1 namespace Test {
2 public class Patient {
3         int id;
4         double age;
5         bool dead;
6         public object this[string name] {
7                 get {
8                         switch (name) {
9                         case "id": return id;
10                         case "age": return age;
11                         case "dead": return dead;
12                         default: return null;
13                         }
14                 }
15                 set {
16                         switch (name) {
17                         case "id":    id = (int)value;    break;
18                         case "age": age = (double)value; break;
19                         case "dead": dead = (bool)value; break;
20                         }
21                 }
22         }
23         public static int Main() {
24                 Patient bob = new Patient();
25                 bob["age"] = 32.0;
26                 if ((bool)bob["dead"])
27                         return 1;
28                 return 0;
29         }
30 }
31 }
32