2010-05-27 Marek Safar <marek.safar@gmail.com>
[mono.git] / mcs / errors / gcs0309-3.cs
1 // CS0309: The type `B' must be convertible to `A' in order to use it as parameter `T' in the generic type or method `Foo<T>'
2 // Line: 35
3 using System;
4
5 public class Foo<T>
6         where T : A
7 {
8         public void Test (T t)
9         {
10                 Console.WriteLine (t);
11                 Console.WriteLine (t.GetType ());
12                 t.Hello ();
13         }
14 }
15
16 public class A
17 {
18         public void Hello ()
19         {
20                 Console.WriteLine ("Hello World");
21         }
22 }
23
24 public class B
25 {
26         public static implicit operator A (B b)
27         {
28                 return new A ();
29         }
30 }
31
32 class X
33 {
34         Foo<B> b;
35
36         static void Main ()
37         {
38         }
39 }