{
[Serializable]
[CLSCompliant (false)]
-#if NET_2_0
[System.Runtime.InteropServices.ComVisible (true)]
-#endif
- public struct UInt32 : IFormattable, IConvertible, IComparable
-#if NET_2_0
- , IComparable<UInt32>, IEquatable <UInt32>
-#endif
+ public struct UInt32 : IFormattable, IConvertible, IComparable, IComparable<UInt32>, IEquatable <UInt32>
{
public const uint MaxValue = 0xffffffff;
public const uint MinValue = 0;
if (!(value is System.UInt32))
throw new ArgumentException (Locale.GetText ("Value is not a System.UInt32."));
- if (this.m_value == (uint) value)
- return 0;
+ uint val = (uint) value;
- if (this.m_value < (uint) value)
- return -1;
+ if (m_value == val)
+ return 0;
- return 1;
+ return (m_value < val) ? -1 : 1;
}
public override bool Equals (object obj)
return (int) m_value;
}
-#if NET_2_0
public int CompareTo (uint value)
{
if (m_value == value)
return -1;
}
- public bool Equals (uint value)
+ public bool Equals (uint obj)
{
- return value == m_value;
+ return obj == m_value;
}
-#endif
internal static bool Parse (string s, bool tryParse, out uint result, out Exception exc)
{
return false;
}
- NumberFormatInfo nfi;
+ NumberFormatInfo nfi = null;
if (provider != null) {
Type typeNFI = typeof (NumberFormatInfo);
nfi = (NumberFormatInfo) provider.GetFormat (typeNFI);
}
- else
+ if (nfi == null)
nfi = Thread.CurrentThread.CurrentCulture.NumberFormat;
if (!Int32.CheckStyle (style, tryParse, ref exc))
}
[CLSCompliant (false)]
- public static uint Parse (string s, NumberStyles style, IFormatProvider fp)
+ public static uint Parse (string s, NumberStyles style, IFormatProvider provider)
{
Exception exc;
uint res;
- if (!Parse (s, style, fp, false, out res, out exc))
+ if (!Parse (s, style, provider, false, out res, out exc))
throw exc;
return res;
return Parse (s, style, null);
}
-#if NET_2_0
[CLSCompliant (false)]
public static bool TryParse (string s, out uint result)
{
return true;
}
-#endif
public override string ToString ()
{
return ToString (format, null);
}
- public string ToString (string format, IFormatProvider fp)
+ public string ToString (string format, IFormatProvider provider)
{
- return NumberFormatter.NumberToString (format, m_value, fp);
+ return NumberFormatter.NumberToString (format, m_value, provider);
}
// =========== IConvertible Methods =========== //
return System.Convert.ToSingle (m_value);
}
- object IConvertible.ToType (Type conversionType, IFormatProvider provider)
+ object IConvertible.ToType (Type targetType, IFormatProvider provider)
{
- return System.Convert.ToType (m_value, conversionType, provider);
+ if (targetType == null)
+ throw new ArgumentNullException ("targetType");
+
+ return System.Convert.ToType (m_value, targetType, provider, false);
}
ushort IConvertible.ToUInt16 (IFormatProvider provider)