11 [__DynamicallyInvokable]
14 internal short m_value;
17 [__DynamicallyInvokable]
21 [__DynamicallyInvokable]
38 return this - (short)value;
46 [__DynamicallyInvokable]
56 [__DynamicallyInvokable]
57 public override bool Equals(
object obj)
63 return this == (short)obj;
71 [__DynamicallyInvokable]
79 [__DynamicallyInvokable]
82 return (ushort)
this | (
this << 16);
87 [SecuritySafeCritical]
88 [__DynamicallyInvokable]
97 [SecuritySafeCritical]
98 [__DynamicallyInvokable]
107 [__DynamicallyInvokable]
117 [__DynamicallyInvokable]
123 [SecuritySafeCritical]
126 if (this < 0 && format != null && format.Length > 0 && (format[0] ==
'X' || format[0] ==
'x'))
128 uint value = (uint)(
this & 0xFFFF);
129 return Number.FormatUInt32(value, format, info);
131 return Number.FormatInt32(
this, format, info);
143 [__DynamicallyInvokable]
163 [__DynamicallyInvokable]
180 [__DynamicallyInvokable]
201 [__DynamicallyInvokable]
213 num = Number.ParseInt32(s, style, info);
215 catch (OverflowException innerException)
217 throw new OverflowException(Environment.GetResourceString(
"Overflow_Int16"), innerException);
221 if (num < 0 || num > 65535)
223 throw new OverflowException(Environment.GetResourceString(
"Overflow_Int16"));
227 if (num < -32768 || num > 32767)
229 throw new OverflowException(Environment.GetResourceString(
"Overflow_Int16"));
239 [__DynamicallyInvokable]
240 public static bool TryParse(
string s, out
short result)
255 [__DynamicallyInvokable]
265 if (!Number.TryParseInt32(s, style, info, out
int result2))
271 if (result2 < 0 || result2 > 65535)
275 result = (short)result2;
278 if (result2 < -32768 || result2 > 32767)
282 result = (short)result2;
297 [__DynamicallyInvokable]
306 [__DynamicallyInvokable]
315 [__DynamicallyInvokable]
324 [__DynamicallyInvokable]
333 [__DynamicallyInvokable]
342 [__DynamicallyInvokable]
351 [__DynamicallyInvokable]
360 [__DynamicallyInvokable]
369 [__DynamicallyInvokable]
378 [__DynamicallyInvokable]
387 [__DynamicallyInvokable]
396 [__DynamicallyInvokable]
405 [__DynamicallyInvokable]
415 [__DynamicallyInvokable]
425 [__DynamicallyInvokable]
428 return Convert.DefaultToType(
this, type, provider);
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.
static long ToInt64(object value)
Converts the value of the specified object to a 64-bit signed integer.
const short MinValue
Represents the smallest possible value of T:System.Int16. This field is constant.
static double ToDouble(object value)
Converts the value of the specified object to a double-precision floating-point number.
static short Parse(string s, NumberStyles style, IFormatProvider provider)
Converts the string representation of a number in a specified style and culture-specific format to it...
override string ToString()
Converts the numeric value of this instance to its equivalent string representation.
string ToString(string format, IFormatProvider provider)
Converts the numeric value of this instance to its equivalent string representation using the specifi...
double ToDouble(IFormatProvider provider)
Converts the value of this instance to an equivalent double-precision floating-point number using the...
bool Equals(short obj)
Returns a value indicating whether this instance is equal to a specified T:System....
const short MaxValue
Represents the largest possible value of an T:System.Int16. This field is constant.
static bool TryParse(string s, out short result)
Converts the string representation of a number to its 16-bit signed integer equivalent....
static bool TryParse(string s, NumberStyles style, IFormatProvider provider, out short result)
Converts the string representation of a number in a specified style and culture-specific format to it...
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.
static float ToSingle(object value)
Converts the value of the specified object to a single-precision floating-point number.
static short Parse(string s, NumberStyles style)
Converts the string representation of a number in a specified style to its 16-bit signed integer equi...
override bool Equals(object obj)
Returns a value indicating whether this instance is equal to a specified object.
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...
Represents an instant in time, typically expressed as a date and time of day. To browse the ....
DateTime ToDateTime(IFormatProvider provider)
Converts the value of this instance to an equivalent T:System.DateTime using the specified culture-sp...
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 ...
int CompareTo(short value)
Compares this instance to a specified 16-bit signed integer and returns an integer that indicates whe...
NumberStyles
Determines the styles permitted in numeric string arguments that are passed to the Parse and TryParse...
override int GetHashCode()
Returns the hash code for this instance.
static short Parse(string s)
Converts the string representation of a number to its 16-bit signed integer equivalent.
string ToString(IFormatProvider provider)
Converts the numeric value of this instance to its equivalent string representation using the specifi...
static char ToChar(object value)
Converts the value of the specified object to a Unicode character.
Provides information about, and means to manipulate, the current environment and platform....
static bool ToBoolean(object value)
Converts the value of a specified object to an equivalent Boolean value.
decimal ToDecimal(IFormatProvider provider)
Converts the value of this instance to an equivalent T:System.Decimal number using the specified cult...
static short Parse(string s, IFormatProvider provider)
Converts the string representation of a number in a specified culture-specific format to its 16-bit s...
int ToInt32(IFormatProvider provider)
Converts the value of this instance to an equivalent 32-bit signed integer using the specified cultur...
static ushort ToUInt16(object value)
Converts the value of the specified object to a 16-bit unsigned integer.
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.
Represents type declarations: class types, interface types, array types, value types,...
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.
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.
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 byte ToByte(object value)
Converts the value of the specified object to an 8-bit unsigned integer.
Defines a generalized method that a value type or class implements to create a type-specific method f...
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...
int CompareTo(object value)
Compares this instance to a specified object and returns an integer that indicates whether the value ...
static ulong ToUInt64(object value)
Converts the value of the specified object to a 64-bit unsigned integer.
static int ToInt32(object value)
Converts the value of the specified object to a 32-bit signed integer.
byte ToByte(IFormatProvider provider)
Converts the value of this instance to an equivalent 8-bit unsigned integer using the specified cultu...
string ToString(string format)
Converts the numeric value of this instance to its equivalent string representation,...
Defines methods that convert the value of the implementing reference or value type to a common langua...
Represents a 16-bit signed integer.
uint ToUInt32(IFormatProvider provider)
Converts the value of this instance to an equivalent 32-bit unsigned integer using the specified cult...
TypeCode GetTypeCode()
Returns the T:System.TypeCode for value type T:System.Int16.