1 // sestoft@dina.kvl.dk * 2004-08
6 public static void Main(String
[] args
) {
7 Foo
<int?> fni1
= new Foo
<int?>(null);
8 Console
.WriteLine(fni1
.Fmt());
9 Foo
<int?> fni2
= new Foo
<int?>(17);
10 Console
.WriteLine(fni2
.Fmt());
11 Foo
<int> fi
= new Foo
<int>(7);
12 Console
.WriteLine(fi
.Fmt());
13 Foo
<String
> fs1
= new Foo
<String
>(null);
14 Console
.WriteLine(fs1
.Fmt());
15 Foo
<String
> fs2
= new Foo
<String
>("haha");
16 Console
.WriteLine(fs2
.Fmt());
26 // This shows how to deal with tests for null in a generic setting
27 // where null may mean both `null reference' and `null value of a
28 // nullable type'. Namely, the test (x == null) will always be
29 // false if the generic type parameter t is instantiated with a
30 // nullable type. Reason: the null literal will be considered a
31 // null reference and x will be boxed if a value type, and hence the
32 // comparison will be false...