Hmm, remove this for the moment.
[mono.git] / mcs / class / corlib / System / Nullable.cs
1 //
2 // System.Nullable
3 //
4 // Martin Baulig (martin@ximian.com)
5 //
6 // (C) 2004 Novell, Inc.
7 //
8
9 using System.Reflection;
10 using System.Collections.Generic;
11 using System.Runtime.CompilerServices;
12
13 #if NET_1_2
14 namespace System
15 {
16         public struct Nullable<T>
17         {
18                 T value;
19                 bool has_value;
20
21                 public Nullable (T value)
22                 {
23                         this.value = value;
24                         this.has_value = true;
25                 }
26
27                 public bool HasValue {
28                         get { return has_value; }
29                 }
30
31                 public T Value {
32                         get { return value; }
33                 }
34
35                 public T GetValueOrDefault ()
36                 {
37                         if (has_value)
38                                 return value;
39                         return default (T);
40                 }
41
42                 public T GetValueOrDefault (T def_value)
43                 {
44                         if (has_value)
45                                 return value;
46                         else
47                                 return def_value;
48                 }
49         }
50 }
51 #endif