They're not CLS-compliant.
[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         [CLSCompliant(false)]
17         public struct Nullable<T>
18         {
19                 T value;
20                 bool has_value;
21
22                 public Nullable (T value)
23                 {
24                         this.value = value;
25                         this.has_value = true;
26                 }
27
28                 public bool HasValue {
29                         get { return has_value; }
30                 }
31
32                 public T Value {
33                         get { return value; }
34                 }
35
36                 public T GetValueOrDefault ()
37                 {
38                         if (has_value)
39                                 return value;
40                         return default (T);
41                 }
42
43                 public T GetValueOrDefault (T def_value)
44                 {
45                         if (has_value)
46                                 return value;
47                         else
48                                 return def_value;
49                 }
50         }
51 }
52 #endif