mscorlib(4.0.0.0) API with additions
UInt64.cs
4 using System.Security;
5 
6 namespace System
7 {
10  [CLSCompliant(false)]
11  [ComVisible(true)]
12  [__DynamicallyInvokable]
14  {
15  private ulong m_value;
16 
18  [__DynamicallyInvokable]
19  public const ulong MaxValue = 18446744073709551615uL;
20 
22  [__DynamicallyInvokable]
23  public const ulong MinValue = 0uL;
24 
31  public int CompareTo(object value)
32  {
33  if (value == null)
34  {
35  return 1;
36  }
37  if (value is ulong)
38  {
39  ulong num = (ulong)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_MustBeUInt64"));
51  }
52 
56  [__DynamicallyInvokable]
57  public int CompareTo(ulong 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 ulong))
78  {
79  return false;
80  }
81  return this == (ulong)obj;
82  }
83 
88  [NonVersionable]
89  [__DynamicallyInvokable]
90  public bool Equals(ulong obj)
91  {
92  return this == obj;
93  }
94 
97  [__DynamicallyInvokable]
98  public override int GetHashCode()
99  {
100  return (int)this ^ (int)(this >> 32);
101  }
102 
105  [SecuritySafeCritical]
106  [__DynamicallyInvokable]
107  public override string ToString()
108  {
109  return Number.FormatUInt64(this, null, NumberFormatInfo.CurrentInfo);
110  }
111 
115  [SecuritySafeCritical]
116  [__DynamicallyInvokable]
117  public string ToString(IFormatProvider provider)
118  {
119  return Number.FormatUInt64(this, null, NumberFormatInfo.GetInstance(provider));
120  }
121 
126  [SecuritySafeCritical]
127  [__DynamicallyInvokable]
128  public string ToString(string format)
129  {
130  return Number.FormatUInt64(this, format, NumberFormatInfo.CurrentInfo);
131  }
132 
138  [SecuritySafeCritical]
139  [__DynamicallyInvokable]
140  public string ToString(string format, IFormatProvider provider)
141  {
142  return Number.FormatUInt64(this, format, NumberFormatInfo.GetInstance(provider));
143  }
144 
151  [CLSCompliant(false)]
152  [__DynamicallyInvokable]
153  public static ulong Parse(string s)
154  {
155  return Number.ParseUInt64(s, NumberStyles.Integer, NumberFormatInfo.CurrentInfo);
156  }
157 
169  [CLSCompliant(false)]
170  [__DynamicallyInvokable]
171  public static ulong Parse(string s, NumberStyles style)
172  {
173  NumberFormatInfo.ValidateParseStyleInteger(style);
174  return Number.ParseUInt64(s, style, NumberFormatInfo.CurrentInfo);
175  }
176 
184  [CLSCompliant(false)]
185  [__DynamicallyInvokable]
186  public static ulong Parse(string s, IFormatProvider provider)
187  {
188  return Number.ParseUInt64(s, NumberStyles.Integer, NumberFormatInfo.GetInstance(provider));
189  }
190 
203  [CLSCompliant(false)]
204  [__DynamicallyInvokable]
205  public static ulong Parse(string s, NumberStyles style, IFormatProvider provider)
206  {
207  NumberFormatInfo.ValidateParseStyleInteger(style);
208  return Number.ParseUInt64(s, style, NumberFormatInfo.GetInstance(provider));
209  }
210 
216  [CLSCompliant(false)]
217  [__DynamicallyInvokable]
218  public static bool TryParse(string s, out ulong result)
219  {
220  return Number.TryParseUInt64(s, NumberStyles.Integer, NumberFormatInfo.CurrentInfo, out result);
221  }
222 
233  [CLSCompliant(false)]
234  [__DynamicallyInvokable]
235  public static bool TryParse(string s, NumberStyles style, IFormatProvider provider, out ulong result)
236  {
237  NumberFormatInfo.ValidateParseStyleInteger(style);
238  return Number.TryParseUInt64(s, style, NumberFormatInfo.GetInstance(provider), out result);
239  }
240 
244  {
245  return TypeCode.UInt64;
246  }
247 
252  [__DynamicallyInvokable]
254  {
255  return Convert.ToBoolean(this);
256  }
257 
261  [__DynamicallyInvokable]
263  {
264  return Convert.ToChar(this);
265  }
266 
270  [__DynamicallyInvokable]
272  {
273  return Convert.ToSByte(this);
274  }
275 
279  [__DynamicallyInvokable]
281  {
282  return Convert.ToByte(this);
283  }
284 
288  [__DynamicallyInvokable]
290  {
291  return Convert.ToInt16(this);
292  }
293 
297  [__DynamicallyInvokable]
299  {
300  return Convert.ToUInt16(this);
301  }
302 
306  [__DynamicallyInvokable]
308  {
309  return Convert.ToInt32(this);
310  }
311 
315  [__DynamicallyInvokable]
317  {
318  return Convert.ToUInt32(this);
319  }
320 
324  [__DynamicallyInvokable]
326  {
327  return Convert.ToInt64(this);
328  }
329 
333  [__DynamicallyInvokable]
335  {
336  return this;
337  }
338 
342  [__DynamicallyInvokable]
344  {
345  return Convert.ToSingle(this);
346  }
347 
351  [__DynamicallyInvokable]
353  {
354  return Convert.ToDouble(this);
355  }
356 
360  [__DynamicallyInvokable]
362  {
363  return Convert.ToDecimal(this);
364  }
365 
370  [__DynamicallyInvokable]
372  {
373  throw new InvalidCastException(Environment.GetResourceString("InvalidCast_FromTo", "UInt64", "DateTime"));
374  }
375 
380  [__DynamicallyInvokable]
381  object IConvertible.ToType(Type type, IFormatProvider provider)
382  {
383  return Convert.DefaultToType(this, type, provider);
384  }
385  }
386 }
float ToSingle(IFormatProvider provider)
Converts the value of this instance to an equivalent single-precision floating-point number using the...
Converts a base data type to another base data type.
Definition: Convert.cs:10
static long ToInt64(object value)
Converts the value of the specified object to a 64-bit signed integer.
Definition: Convert.cs:2506
static bool TryParse(string s, out ulong result)
Tries to convert the string representation of a number to its 64-bit unsigned integer equivalent....
Definition: UInt64.cs:218
static double ToDouble(object value)
Converts the value of the specified object to a double-precision floating-point number.
Definition: Convert.cs:3189
int CompareTo(ulong value)
Compares this instance to a specified 64-bit unsigned integer and returns an indication of their rela...
Definition: UInt64.cs:57
double ToDouble(IFormatProvider provider)
Converts the value of this instance to an equivalent double-precision floating-point number using the...
string ToString(IFormatProvider provider)
Converts the numeric value of this instance to its equivalent string representation using the specifi...
Definition: UInt64.cs:117
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
string ToString(string format)
Converts the numeric value of this instance to its equivalent string representation using the specifi...
Definition: UInt64.cs:128
static float ToSingle(object value)
Converts the value of the specified object to a single-precision floating-point number.
Definition: Convert.cs:2982
static ulong Parse(string s, NumberStyles style)
Converts the string representation of a number in a specified style to its 64-bit unsigned integer eq...
Definition: UInt64.cs:171
override string ToString()
Converts the numeric value of this instance to its equivalent string representation.
Definition: UInt64.cs:107
Definition: __Canon.cs:3
The exception that is thrown for invalid casting or explicit conversion.
string ToString(string format, IFormatProvider provider)
Converts the numeric value of this instance to its equivalent string representation using the specifi...
Definition: UInt64.cs:140
char ToChar(IFormatProvider provider)
Converts the value of this instance to an equivalent Unicode character using the specified culture-sp...
const ulong MinValue
Represents the smallest possible value of T:System.UInt64. This field is constant.
Definition: UInt64.cs:23
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
bool Equals(ulong obj)
Returns a value indicating whether this instance is equal to a specified T:System....
Definition: UInt64.cs:90
DateTime ToDateTime(IFormatProvider provider)
Converts the value of this instance to an equivalent T:System.DateTime using the specified culture-sp...
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
NumberStyles
Determines the styles permitted in numeric string arguments that are passed to the Parse and TryParse...
Definition: NumberStyles.cs:10
static char ToChar(object value)
Converts the value of the specified object to a Unicode character.
Definition: Convert.cs:670
int CompareTo(object value)
Compares this instance to a specified object and returns an indication of their relative values.
Definition: UInt64.cs:31
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
const ulong MaxValue
Represents the largest possible value of T:System.UInt64. This field is constant.
Definition: UInt64.cs:19
decimal ToDecimal(IFormatProvider provider)
Converts the value of this instance to an equivalent T:System.Decimal number using the specified cult...
int ToInt32(IFormatProvider provider)
Converts the value of this instance to an equivalent 32-bit signed integer using the specified cultur...
static ulong Parse(string s)
Converts the string representation of a number to its 64-bit unsigned integer equivalent.
Definition: UInt64.cs:153
static NumberFormatInfo GetInstance(IFormatProvider formatProvider)
Gets the T:System.Globalization.NumberFormatInfo associated with the specified T:System....
TypeCode GetTypeCode()
Returns the T:System.TypeCode for value type T:System.UInt64.
Definition: UInt64.cs:243
Represents a 64-bit unsigned integer.
Definition: UInt64.cs:13
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
static ulong Parse(string s, IFormatProvider provider)
Converts the string representation of a number in a specified culture-specific format to its 64-bit u...
Definition: UInt64.cs:186
static bool TryParse(string s, NumberStyles style, IFormatProvider provider, out ulong result)
Tries to convert the string representation of a number in a specified style and culture-specific form...
Definition: UInt64.cs:235
ushort ToUInt16(IFormatProvider provider)
Converts the value of this instance to an equivalent 16-bit unsigned integer using the specified cult...
static uint ToUInt32(object value)
Converts the value of the specified object to a 32-bit unsigned integer.
Definition: Convert.cs:2235
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...
override bool Equals(object obj)
Returns a value indicating whether this instance is equal to a specified object.
Definition: UInt64.cs:75
The exception that is thrown when one of the arguments provided to a method is not valid.
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 short ToInt16(object value)
Converts the value of the specified object to a 16-bit signed integer.
Definition: Convert.cs:1452
Specifies that the class can be serialized.
ulong ToUInt64(IFormatProvider provider)
Converts the value of this instance to an equivalent 64-bit unsigned integer using the specified cult...
static int ToInt32(object value)
Converts the value of the specified object to a 32-bit signed integer.
Definition: Convert.cs:1974
byte ToByte(IFormatProvider provider)
Converts the value of this instance to an equivalent 8-bit unsigned integer using the specified cultu...
override int GetHashCode()
Returns the hash code for this instance.
Definition: UInt64.cs:98
Defines methods that convert the value of the implementing reference or value type to a common langua...
Definition: IConvertible.cs:9
static ulong 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: UInt64.cs:205
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.