2010-04-07 Jb Evain <jbevain@novell.com>
[mcs.git] / tests / gtest-038.cs
blobc39eb3db6781ea75ce2884d0c58b21f188837911
1 //
2 // Another important test: nested generic types.
3 //
5 using System;
7 class Queue<T>
9 public Queue (T first, T second)
11 head = new Node<T> (null, second);
12 head = new Node<T> (head, first);
15 protected Node<T> head;
17 protected Node<T> GetFoo ()
19 return head;
22 protected Node<T> Foo {
23 get {
24 return GetFoo ();
28 protected void Test (T t)
30 Console.WriteLine (t);
33 public void Test ()
35 Test (head.Item);
36 Test (head.Next.Item);
37 Test (GetFoo ().Item);
38 Test (Foo.Item);
41 protected class Node<U>
43 public readonly U Item;
44 public readonly Node<U> Next;
46 public Node (Node<U> next, U item)
48 this.Next = next;
49 this.Item = item;
54 class X
56 static void Main ()
58 Queue<int> queue = new Queue<int> (5, 9);
59 queue.Test ();