5 // Miguel de Icaza (miguel@ximian.com)
7 // (C) Ximian, Inc. http://www.ximian.com
10 using System.Globalization;
14 public struct UInt32 : IComparable, IFormattable { //, IConvertible {
15 public static Type Type = typeof (uint);
17 public const uint MaxValue = 0xffffffff;
18 public const uint MinValue = 0;
22 public int CompareTo (object v)
24 if (!(v is System.UInt32))
25 throw new ArgumentException ("Value is not a System.UInt32");
27 if (value == (uint) v)
36 public override bool Equals (object o)
38 if (!(o is System.UInt32))
41 return ((uint) o) == value;
44 public override int GetHashCode ()
49 public static uint Parse (string s)
51 return Parse (s, NumberStyles.Integer, null);
54 public static uint Parse (string s, IFormatProvider fp)
56 return Parse (s, NumberStyles.Integer, fp);
59 public static uint Parse (string s, NumberStyles style)
61 return Parse (s, style, null);
64 public static uint Parse (string s, NumberStyles style, IFormatProvider fp)
70 public override string ToString ()
72 return ToString ("G", null);
75 public string ToString (IFormatProvider fp)
77 return ToString ("G", fp);
80 public string ToString (string format)
82 return ToString (format, null);
85 public string ToString (string format, IFormatProvider fp)
90 fmt = (format == null) ? "G" : format;
93 nfi = NumberFormatInfo.CurrentInfo;
95 nfi = (NumberFormatInfo) fp.GetFormat (Type);
98 nfi = NumberFormatInfo.CurrentInfo;
101 return IntegerFormatter.NumberToString (fmt, nfi, value);
104 // =========== IConvertible Methods =========== //
106 public TypeCode GetTypeCode ()
108 return TypeCode.UInt32;