mscorlib(4.0.0.0) API with additions
UInt32.cs
4 using System.Security;
5 
6 namespace System
7 {
10  [CLSCompliant(false)]
11  [ComVisible(true)]
12  [__DynamicallyInvokable]
14  {
15  private uint m_value;
16 
18  [__DynamicallyInvokable]
19  public const uint MaxValue = 4294967295u;
20 
22  [__DynamicallyInvokable]
23  public const uint MinValue = 0u;
24 
31  public int CompareTo(object value)
32  {
33  if (value == null)
34  {
35  return 1;
36  }
37  if (value is uint)
38  {
39  uint num = (uint)value;
40  if (this < num)
41  {
42  return -1;
43  }
44  if (this > num)
45  {
46  return 1;
47  }
48  return 0;
49  }
50  throw new ArgumentException(Environment.GetResourceString("Arg_MustBeUInt32"));
51  }
52 
56  [__DynamicallyInvokable]
57  public int CompareTo(uint value)
58  {
59  if (this < value)
60  {
61  return -1;
62  }
63  if (this > value)
64  {
65  return 1;
66  }
67  return 0;
68  }
69 
74  [__DynamicallyInvokable]
75  public override bool Equals(object obj)
76  {
77  if (!(obj is uint))
78  {
79  return false;
80  }
81  return this == (uint)obj;
82  }
83 
88  [NonVersionable]
89  [__DynamicallyInvokable]
90  public bool Equals(uint obj)
91  {
92  return this == obj;
93  }
94 
97  [__DynamicallyInvokable]
98  public override int GetHashCode()
99  {
100  return (int)this;
101  }
102 
105  [SecuritySafeCritical]
106  [__DynamicallyInvokable]
107  public override string ToString()
108  {
109  return Number.FormatUInt32(this, null, NumberFormatInfo.CurrentInfo);
110  }
111 
115  [SecuritySafeCritical]
116  [__DynamicallyInvokable]
117  public string ToString(IFormatProvider provider)
118  {
119  return Number.FormatUInt32(this, null, NumberFormatInfo.GetInstance(provider));
120  }
121 
126  [SecuritySafeCritical]
127  [__DynamicallyInvokable]
128  public string ToString(string format)
129  {
130  return Number.FormatUInt32(this, format, NumberFormatInfo.CurrentInfo);
131  }
132 
138  [SecuritySafeCritical]
139  [__DynamicallyInvokable]
140  public string ToString(string format, IFormatProvider provider)
141  {
142  return Number.FormatUInt32(this, format, NumberFormatInfo.GetInstance(provider));
143  }
144 
151  [CLSCompliant(false)]
152  [__DynamicallyInvokable]
153  public static uint Parse(string s)
154  {
155  return Number.ParseUInt32(s, NumberStyles.Integer, NumberFormatInfo.CurrentInfo);
156  }
157 
172  [CLSCompliant(false)]
173  [__DynamicallyInvokable]
174  public static uint Parse(string s, NumberStyles style)
175  {
176  NumberFormatInfo.ValidateParseStyleInteger(style);
177  return Number.ParseUInt32(s, style, NumberFormatInfo.CurrentInfo);
178  }
179 
190  [CLSCompliant(false)]
191  [__DynamicallyInvokable]
192  public static uint Parse(string s, IFormatProvider provider)
193  {
194  return Number.ParseUInt32(s, NumberStyles.Integer, NumberFormatInfo.GetInstance(provider));
195  }
196 
212  [CLSCompliant(false)]
213  [__DynamicallyInvokable]
214  public static uint Parse(string s, NumberStyles style, IFormatProvider provider)
215  {
216  NumberFormatInfo.ValidateParseStyleInteger(style);
217  return Number.ParseUInt32(s, style, NumberFormatInfo.GetInstance(provider));
218  }
219 
225  [CLSCompliant(false)]
226  [__DynamicallyInvokable]
227  public static bool TryParse(string s, out uint result)
228  {
229  return Number.TryParseUInt32(s, NumberStyles.Integer, NumberFormatInfo.CurrentInfo, out result);
230  }
231 
242  [CLSCompliant(false)]
243  [__DynamicallyInvokable]
244  public static bool TryParse(string s, NumberStyles style, IFormatProvider provider, out uint result)
245  {
246  NumberFormatInfo.ValidateParseStyleInteger(style);
247  return Number.TryParseUInt32(s, style, NumberFormatInfo.GetInstance(provider), out result);
248  }
249 
253  {
254  return TypeCode.UInt32;
255  }
256 
261  [__DynamicallyInvokable]
263  {
264  return Convert.ToBoolean(this);
265  }
266 
270  [__DynamicallyInvokable]
272  {
273  return Convert.ToChar(this);
274  }
275 
279  [__DynamicallyInvokable]
281  {
282  return Convert.ToSByte(this);
283  }
284 
288  [__DynamicallyInvokable]
290  {
291  return Convert.ToByte(this);
292  }
293 
297  [__DynamicallyInvokable]
299  {
300  return Convert.ToInt16(this);
301  }
302 
306  [__DynamicallyInvokable]
308  {
309  return Convert.ToUInt16(this);
310  }
311 
315  [__DynamicallyInvokable]
317  {
318  return Convert.ToInt32(this);
319  }
320 
324  [__DynamicallyInvokable]
326  {
327  return this;
328  }
329 
333  [__DynamicallyInvokable]
335  {
336  return Convert.ToInt64(this);
337  }
338 
342  [__DynamicallyInvokable]
344  {
345  return Convert.ToUInt64(this);
346  }
347 
351  [__DynamicallyInvokable]
353  {
354  return Convert.ToSingle(this);
355  }
356 
360  [__DynamicallyInvokable]
362  {
363  return Convert.ToDouble(this);
364  }
365 
369  [__DynamicallyInvokable]
371  {
372  return Convert.ToDecimal(this);
373  }
374 
379  [__DynamicallyInvokable]
381  {
382  throw new InvalidCastException(Environment.GetResourceString("InvalidCast_FromTo", "UInt32", "DateTime"));
383  }
384 
389  [__DynamicallyInvokable]
390  object IConvertible.ToType(Type type, IFormatProvider provider)
391  {
392  return Convert.DefaultToType(this, type, provider);
393  }
394  }
395 }
float ToSingle(IFormatProvider provider)
Converts the value of this instance to an equivalent single-precision floating-point number using the...
override string ToString()
Converts the numeric value of this instance to its equivalent string representation.
Definition: UInt32.cs:107
Converts a base data type to another base data type.
Definition: Convert.cs:10
static bool TryParse(string s, NumberStyles style, IFormatProvider provider, out uint result)
Tries to convert the string representation of a number in a specified style and culture-specific form...
Definition: UInt32.cs:244
static bool TryParse(string s, out uint result)
Tries to convert the string representation of a number to its 32-bit unsigned integer equivalent....
Definition: UInt32.cs:227
static long ToInt64(object value)
Converts the value of the specified object to a 64-bit signed integer.
Definition: Convert.cs:2506
static double ToDouble(object value)
Converts the value of the specified object to a double-precision floating-point number.
Definition: Convert.cs:3189
double ToDouble(IFormatProvider provider)
Converts the value of this instance to an equivalent double-precision floating-point number using the...
override int GetHashCode()
Returns the hash code for this instance.
Definition: UInt32.cs:98
bool ToBoolean(IFormatProvider provider)
Converts the value of this instance to an equivalent Boolean value using the specified culture-specif...
TypeCode
Specifies the type of an object.
Definition: TypeCode.cs:9
static float ToSingle(object value)
Converts the value of the specified object to a single-precision floating-point number.
Definition: Convert.cs:2982
Definition: __Canon.cs:3
The exception that is thrown for invalid casting or explicit conversion.
char ToChar(IFormatProvider provider)
Converts the value of this instance to an equivalent Unicode character using the specified culture-sp...
Provides a mechanism for retrieving an object to control formatting.
Represents an instant in time, typically expressed as a date and time of day. To browse the ....
Definition: DateTime.cs:13
DateTime ToDateTime(IFormatProvider provider)
Converts the value of this instance to an equivalent T:System.DateTime using the specified culture-sp...
const uint MaxValue
Represents the largest possible value of T:System.UInt32. This field is constant.
Definition: UInt32.cs:19
static NumberFormatInfo CurrentInfo
Gets a read-only T:System.Globalization.NumberFormatInfo that formats values based on the current cul...
sbyte ToSByte(IFormatProvider provider)
Converts the value of this instance to an equivalent 8-bit signed integer using the specified culture...
Defines a generalized type-specific comparison method that a value type or class implements to order ...
Definition: IComparable.cs:8
string ToString(string format, IFormatProvider provider)
Converts the numeric value of this instance to its equivalent string representation using the specifi...
Definition: UInt32.cs:140
NumberStyles
Determines the styles permitted in numeric string arguments that are passed to the Parse and TryParse...
Definition: NumberStyles.cs:10
bool Equals(uint obj)
Returns a value indicating whether this instance is equal to a specified T:System....
Definition: UInt32.cs:90
static char ToChar(object value)
Converts the value of the specified object to a Unicode character.
Definition: Convert.cs:670
Provides information about, and means to manipulate, the current environment and platform....
Definition: Environment.cs:21
static bool ToBoolean(object value)
Converts the value of a specified object to an equivalent Boolean value.
Definition: Convert.cs:457
decimal ToDecimal(IFormatProvider provider)
Converts the value of this instance to an equivalent T:System.Decimal number using the specified cult...
TypeCode GetTypeCode()
Returns the T:System.TypeCode for value type T:System.UInt32.
Definition: UInt32.cs:252
int ToInt32(IFormatProvider provider)
Converts the value of this instance to an equivalent 32-bit signed integer using the specified cultur...
static NumberFormatInfo GetInstance(IFormatProvider formatProvider)
Gets the T:System.Globalization.NumberFormatInfo associated with the specified T:System....
string ToString(string format)
Converts the numeric value of this instance to its equivalent string representation using the specifi...
Definition: UInt32.cs:128
static ushort ToUInt16(object value)
Converts the value of the specified object to a 16-bit unsigned integer.
Definition: Convert.cs:1707
object ToType(Type conversionType, IFormatProvider provider)
Converts the value of this instance to an T:System.Object of the specified T:System....
static sbyte ToSByte(object value)
Converts the value of the specified object to an 8-bit signed integer.
Definition: Convert.cs:909
Represents type declarations: class types, interface types, array types, value types,...
Definition: Type.cs:18
ushort ToUInt16(IFormatProvider provider)
Converts the value of this instance to an equivalent 16-bit unsigned integer using the specified cult...
string ToString(IFormatProvider provider)
Converts the numeric value of this instance to its equivalent string representation using the specifi...
Definition: UInt32.cs:117
short ToInt16(IFormatProvider provider)
Converts the value of this instance to an equivalent 16-bit signed integer using the specified cultur...
static decimal ToDecimal(object value)
Converts the value of the specified object to an equivalent decimal number.
Definition: Convert.cs:3394
long ToInt64(IFormatProvider provider)
Converts the value of this instance to an equivalent 64-bit signed integer using the specified cultur...
The exception that is thrown when one of the arguments provided to a method is not valid.
static uint Parse(string s, NumberStyles style, IFormatProvider provider)
Converts the string representation of a number in a specified style and culture-specific format to it...
Definition: UInt32.cs:214
const uint MinValue
Represents the smallest possible value of T:System.UInt32. This field is constant.
Definition: UInt32.cs:23
static byte ToByte(object value)
Converts the value of the specified object to an 8-bit unsigned integer.
Definition: Convert.cs:1186
Defines a generalized method that a value type or class implements to create a type-specific method f...
Definition: IEquatable.cs:6
static uint Parse(string s, IFormatProvider provider)
Converts the string representation of a number in a specified culture-specific format to its 32-bit u...
Definition: UInt32.cs:192
Represents a 32-bit unsigned integer.
Definition: UInt32.cs:13
static short ToInt16(object value)
Converts the value of the specified object to a 16-bit signed integer.
Definition: Convert.cs:1452
int CompareTo(object value)
Compares this instance to a specified object and returns an indication of their relative values.
Definition: UInt32.cs:31
Specifies that the class can be serialized.
override bool Equals(object obj)
Returns a value indicating whether this instance is equal to a specified object.
Definition: UInt32.cs:75
ulong ToUInt64(IFormatProvider provider)
Converts the value of this instance to an equivalent 64-bit unsigned integer using the specified cult...
int CompareTo(uint value)
Compares this instance to a specified 32-bit unsigned integer and returns an indication of their rela...
Definition: UInt32.cs:57
static ulong ToUInt64(object value)
Converts the value of the specified object to a 64-bit unsigned integer.
Definition: Convert.cs:2727
static int ToInt32(object value)
Converts the value of the specified object to a 32-bit signed integer.
Definition: Convert.cs:1974
static uint Parse(string s, NumberStyles style)
Converts the string representation of a number in a specified style to its 32-bit unsigned integer eq...
Definition: UInt32.cs:174
byte ToByte(IFormatProvider provider)
Converts the value of this instance to an equivalent 8-bit unsigned integer using the specified cultu...
Defines methods that convert the value of the implementing reference or value type to a common langua...
Definition: IConvertible.cs:9
static uint Parse(string s)
Converts the string representation of a number to its 32-bit unsigned integer equivalent.
Definition: UInt32.cs:153
Provides functionality to format the value of an object into a string representation.
Definition: IFormattable.cs:8
uint ToUInt32(IFormatProvider provider)
Converts the value of this instance to an equivalent 32-bit unsigned integer using the specified cult...
Provides culture-specific information for formatting and parsing numeric values.