4 // Martin Baulig (martin@ximian.com)
6 // (C) 2004 Novell, Inc.
9 using System.Reflection;
10 using System.Collections.Generic;
11 using System.Runtime.CompilerServices;
16 public struct Nullable<T> : IComparable<Nullable<T>>
21 public Nullable (T value)
24 this.has_value = true;
27 public bool HasValue {
28 get { return has_value; }
35 public T GetValueOrDefault ()
42 public T GetValueOrDefault (T def_value)
50 public int CompareTo (Nullable<T> other)
52 if (!has_value && other.has_value)
54 else if (has_value && !other.has_value)
56 else if (!has_value && !other.has_value)
58 else if (value == other.value)