mscorlib(4.0.0.0) API with additions
System.SByte Struct Reference

Represents an 8-bit signed integer. More...

Inheritance diagram for System.SByte:
[legend]
Collaboration diagram for System.SByte:
[legend]

Public Member Functions

int CompareTo (object obj)
 Compares this instance to a specified object and returns an indication of their relative values. More...
 
int CompareTo (sbyte value)
 Compares this instance to a specified 8-bit signed integer and returns an indication of their relative values. More...
 
override bool Equals (object obj)
 Returns a value indicating whether this instance is equal to a specified object. More...
 
bool Equals (sbyte obj)
 Returns a value indicating whether this instance is equal to a specified T:System.SByte value. More...
 
override int GetHashCode ()
 Returns the hash code for this instance. More...
 
override string ToString ()
 Converts the numeric value of this instance to its equivalent string representation. More...
 
string ToString (IFormatProvider provider)
 Converts the numeric value of this instance to its equivalent string representation using the specified culture-specific format information. More...
 
string ToString (string format)
 Converts the numeric value of this instance to its equivalent string representation, using the specified format. More...
 
string ToString (string format, IFormatProvider provider)
 Converts the numeric value of this instance to its equivalent string representation using the specified format and culture-specific format information. More...
 
TypeCode GetTypeCode ()
 Returns the T:System.TypeCode for value type T:System.SByte. More...
 
bool IConvertible. ToBoolean (IFormatProvider provider)
 For a description of this member, see M:System.IConvertible.ToBoolean(System.IFormatProvider). More...
 
char IConvertible. ToChar (IFormatProvider provider)
 For a description of this member, see M:System.IConvertible.ToChar(System.IFormatProvider). More...
 
sbyte IConvertible. ToSByte (IFormatProvider provider)
 For a description of this member, see M:System.IConvertible.ToSByte(System.IFormatProvider). More...
 
byte IConvertible. ToByte (IFormatProvider provider)
 For a description of this member, see M:System.IConvertible.ToByte(System.IFormatProvider). More...
 
short IConvertible. ToInt16 (IFormatProvider provider)
 For a description of this member, see M:System.IConvertible.ToInt16(System.IFormatProvider). More...
 
ushort IConvertible. ToUInt16 (IFormatProvider provider)
 For a description of this member, see M:System.IConvertible.ToUInt16(System.IFormatProvider). More...
 
int IConvertible. ToInt32 (IFormatProvider provider)
 For a description of this member, see M:System.IConvertible.ToInt32(System.IFormatProvider). More...
 
uint IConvertible. ToUInt32 (IFormatProvider provider)
 For a description of this member, see M:System.IConvertible.ToUInt32(System.IFormatProvider). More...
 
long IConvertible. ToInt64 (IFormatProvider provider)
 For a description of this member, see M:System.IConvertible.ToInt64(System.IFormatProvider). More...
 
ulong IConvertible. ToUInt64 (IFormatProvider provider)
 For a description of this member, see M:System.IConvertible.ToUInt64(System.IFormatProvider). More...
 
float IConvertible. ToSingle (IFormatProvider provider)
 For a description of this member, see M:System.IConvertible.ToSingle(System.IFormatProvider). More...
 
double IConvertible. ToDouble (IFormatProvider provider)
 For a description of this member, see M:System.IConvertible.ToDouble(System.IFormatProvider). More...
 
decimal IConvertible. ToDecimal (IFormatProvider provider)
 For a description of this member, see M:System.IConvertible.ToDecimal(System.IFormatProvider). More...
 
DateTime IConvertible. ToDateTime (IFormatProvider provider)
 This conversion is not supported. Attempting to do so throws an T:System.InvalidCastException. More...
 
object IConvertible. ToType (Type type, IFormatProvider provider)
 For a description of this member, see M:System.IConvertible.ToType(System.Type,System.IFormatProvider). More...
 
- Public Member Functions inherited from System.IEquatable< sbyte >
bool Equals (T other)
 Indicates whether the current object is equal to another object of the same type. More...
 

Static Public Member Functions

static sbyte Parse (string s)
 Converts the string representation of a number to its 8-bit signed integer equivalent. More...
 
static sbyte Parse (string s, NumberStyles style)
 Converts the string representation of a number in a specified style to its 8-bit signed integer equivalent. More...
 
static sbyte Parse (string s, IFormatProvider provider)
 Converts the string representation of a number in a specified culture-specific format to its 8-bit signed integer equivalent. More...
 
static sbyte Parse (string s, NumberStyles style, IFormatProvider provider)
 Converts the string representation of a number that is in a specified style and culture-specific format to its 8-bit signed equivalent. More...
 
static bool TryParse (string s, out sbyte result)
 Tries to convert the string representation of a number to its T:System.SByte equivalent, and returns a value that indicates whether the conversion succeeded. More...
 
static bool TryParse (string s, NumberStyles style, IFormatProvider provider, out sbyte result)
 Tries to convert the string representation of a number in a specified style and culture-specific format to its T:System.SByte equivalent, and returns a value that indicates whether the conversion succeeded. More...
 

Public Attributes

const sbyte MaxValue = 127
 Represents the largest possible value of T:System.SByte. This field is constant. More...
 
const sbyte MinValue = -128
 Represents the smallest possible value of T:System.SByte. This field is constant. More...
 

Detailed Description

Represents an 8-bit signed integer.

Definition at line 13 of file SByte.cs.

Member Function Documentation

◆ CompareTo() [1/2]

int System.SByte.CompareTo ( object  obj)

Compares this instance to a specified object and returns an indication of their relative values.

Parameters
objAn object to compare, or null.
Returns
A signed number indicating the relative values of this instance and obj .Return Value Description Less than zero This instance is less than obj . Zero This instance is equal to obj . Greater than zero This instance is greater than obj .-or- obj is null.
Exceptions
T:System.ArgumentExceptionobj is not an T:System.SByte.

Definition at line 31 of file SByte.cs.

◆ CompareTo() [2/2]

int System.SByte.CompareTo ( sbyte  value)

Compares this instance to a specified 8-bit signed integer and returns an indication of their relative values.

Parameters
valueAn 8-bit signed integer to compare.
Returns
A signed integer that indicates the relative order of this instance and value .Return Value Description Less than zero This instance is less than value . Zero This instance is equal to value . Greater than zero This instance is greater than value .

Definition at line 48 of file SByte.cs.

◆ Equals() [1/2]

override bool System.SByte.Equals ( object  obj)

Returns a value indicating whether this instance is equal to a specified object.

Parameters
objAn object to compare with this instance.
Returns
true if obj is an instance of T:System.SByte and equals the value of this instance; otherwise, false.

Definition at line 58 of file SByte.cs.

◆ Equals() [2/2]

bool System.SByte.Equals ( sbyte  obj)

Returns a value indicating whether this instance is equal to a specified T:System.SByte value.

Parameters
objAn T:System.SByte value to compare to this instance.
Returns
true if obj has the same value as this instance; otherwise, false.

Definition at line 73 of file SByte.cs.

◆ GetHashCode()

override int System.SByte.GetHashCode ( )

Returns the hash code for this instance.

Returns
A 32-bit signed integer hash code.

Definition at line 81 of file SByte.cs.

◆ GetTypeCode()

TypeCode System.SByte.GetTypeCode ( )

Returns the T:System.TypeCode for value type T:System.SByte.

Returns
The enumerated constant, F:System.TypeCode.SByte.

Implements System.IConvertible.

Definition at line 299 of file SByte.cs.

◆ Parse() [1/4]

static sbyte System.SByte.Parse ( string  s)
static

Converts the string representation of a number to its 8-bit signed integer equivalent.

Parameters
sA string that represents a number to convert. The string is interpreted using the F:System.Globalization.NumberStyles.Integer style.
Returns
An 8-bit signed integer that is equivalent to the number contained in the s parameter.
Exceptions
T:System.ArgumentExceptions is null.
T:System.FormatExceptions does not consist of an optional sign followed by a sequence of digits (zero through nine).
T:System.OverflowExceptions represents a number less than F:System.SByte.MinValue or greater than F:System.SByte.MaxValue.

Definition at line 150 of file SByte.cs.

◆ Parse() [2/4]

static sbyte System.SByte.Parse ( string  s,
NumberStyles  style 
)
static

Converts the string representation of a number in a specified style to its 8-bit signed integer equivalent.

Parameters
sA string that contains a number to convert. The string is interpreted using the style specified by style .
styleA bitwise combination of the enumeration values that indicates the style elements that can be present in s . A typical value to specify is F:System.Globalization.NumberStyles.Integer.
Returns
An 8-bit signed integer that is equivalent to the number specified in s .
Exceptions
T:System.ArgumentNullExceptions is null.
T:System.FormatExceptions is not in a format that is compliant with style .
T:System.OverflowExceptions represents a number less than F:System.SByte.MinValue or greater than F:System.SByte.MaxValue. -or- s includes non-zero, fractional digits.
T:System.ArgumentExceptionstyle is not a T:System.Globalization.NumberStyles value. -or- style is not a combination of F:System.Globalization.NumberStyles.AllowHexSpecifier and F:System.Globalization.NumberStyles.HexNumber values.

Definition at line 171 of file SByte.cs.

◆ Parse() [3/4]

static sbyte System.SByte.Parse ( string  s,
IFormatProvider  provider 
)
static

Converts the string representation of a number in a specified culture-specific format to its 8-bit signed integer equivalent.

Parameters
sA string that represents a number to convert. The string is interpreted using the F:System.Globalization.NumberStyles.Integer style.
providerAn object that supplies culture-specific formatting information about s . If provider is null, the thread current culture is used.
Returns
An 8-bit signed integer that is equivalent to the number specified in s .
Exceptions
T:System.ArgumentNullExceptions is null.
T:System.FormatExceptions is not in the correct format.
T:System.OverflowExceptions represents a number less than F:System.SByte.MinValue or greater than F:System.SByte.MaxValue.

Definition at line 189 of file SByte.cs.

◆ Parse() [4/4]

static sbyte System.SByte.Parse ( string  s,
NumberStyles  style,
IFormatProvider  provider 
)
static

Converts the string representation of a number that is in a specified style and culture-specific format to its 8-bit signed equivalent.

Parameters
sA string that contains the number to convert. The string is interpreted by using the style specified by style .
styleA bitwise combination of the enumeration values that indicates the style elements that can be present in s . A typical value to specify is F:System.Globalization.NumberStyles.Integer.
providerAn object that supplies culture-specific formatting information about s . If provider is null, the thread current culture is used.
Returns
An 8-bit signed byte value that is equivalent to the number specified in the s parameter.
Exceptions
T:System.ArgumentExceptionstyle is not a T:System.Globalization.NumberStyles value.-or- style is not a combination of F:System.Globalization.NumberStyles.AllowHexSpecifier and F:System.Globalization.NumberStyles.HexNumber.
T:System.ArgumentNullExceptions is null.
T:System.FormatExceptions is not in a format that is compliant with style .
T:System.OverflowExceptions represents a number that is less than F:System.SByte.MinValue or greater than F:System.SByte.MaxValue.-or- s includes non-zero, fractional digits.

Definition at line 211 of file SByte.cs.

◆ ToBoolean()

bool IConvertible. System.SByte.ToBoolean ( IFormatProvider  provider)

For a description of this member, see M:System.IConvertible.ToBoolean(System.IFormatProvider).

Parameters
providerThis parameter is unused.
Returns
true if the value of the current instance is not zero; otherwise, false.

Implements System.IConvertible.

Definition at line 309 of file SByte.cs.

◆ ToByte()

byte IConvertible. System.SByte.ToByte ( IFormatProvider  provider)

For a description of this member, see M:System.IConvertible.ToByte(System.IFormatProvider).

Parameters
providerThis parameter is unused.
Returns
The value of the current instance, converted to a T:System.Byte.

Implements System.IConvertible.

Definition at line 336 of file SByte.cs.

◆ ToChar()

char IConvertible. System.SByte.ToChar ( IFormatProvider  provider)

For a description of this member, see M:System.IConvertible.ToChar(System.IFormatProvider).

Parameters
providerThis parameter is ignored.
Returns
The value of the current instance, converted to a T:System.Char.

Implements System.IConvertible.

Definition at line 318 of file SByte.cs.

◆ ToDateTime()

DateTime IConvertible. System.SByte.ToDateTime ( IFormatProvider  provider)

This conversion is not supported. Attempting to do so throws an T:System.InvalidCastException.

Parameters
providerThis parameter is ignored.
Returns
None. This conversion is not supported.
Exceptions
T:System.InvalidCastExceptionIn all cases.

Implements System.IConvertible.

Definition at line 427 of file SByte.cs.

◆ ToDecimal()

decimal IConvertible. System.SByte.ToDecimal ( IFormatProvider  provider)

For a description of this member, see M:System.IConvertible.ToDecimal(System.IFormatProvider).

Parameters
providerThis parameter is unused.
Returns
The value of the current instance, converted to a T:System.Decimal.

Implements System.IConvertible.

Definition at line 417 of file SByte.cs.

◆ ToDouble()

double IConvertible. System.SByte.ToDouble ( IFormatProvider  provider)

For a description of this member, see M:System.IConvertible.ToDouble(System.IFormatProvider).

Parameters
providerThis parameter is ignored.
Returns
The value of the current instance, converted to a T:System.Double.

Implements System.IConvertible.

Definition at line 408 of file SByte.cs.

◆ ToInt16()

short IConvertible. System.SByte.ToInt16 ( IFormatProvider  provider)

For a description of this member, see M:System.IConvertible.ToInt16(System.IFormatProvider).

Parameters
providerThis parameter is ignored.
Returns
The value of the current instance, converted to an T:System.Int16.

Implements System.IConvertible.

Definition at line 345 of file SByte.cs.

◆ ToInt32()

int IConvertible. System.SByte.ToInt32 ( IFormatProvider  provider)

For a description of this member, see M:System.IConvertible.ToInt32(System.IFormatProvider).

Parameters
providerThis parameter is ignored.
Returns
The value of the current instance, converted to an T:System.Int32.

Implements System.IConvertible.

Definition at line 363 of file SByte.cs.

◆ ToInt64()

long IConvertible. System.SByte.ToInt64 ( IFormatProvider  provider)

For a description of this member, see M:System.IConvertible.ToInt64(System.IFormatProvider).

Parameters
providerThis parameter is ignored.
Returns
The value of the current instance, converted to an T:System.Int64.

Implements System.IConvertible.

Definition at line 381 of file SByte.cs.

◆ ToSByte()

sbyte IConvertible. System.SByte.ToSByte ( IFormatProvider  provider)

For a description of this member, see M:System.IConvertible.ToSByte(System.IFormatProvider).

Parameters
providerThis parameter is ignored.
Returns
The value of the current instance, unchanged.

Implements System.IConvertible.

Definition at line 327 of file SByte.cs.

◆ ToSingle()

float IConvertible. System.SByte.ToSingle ( IFormatProvider  provider)

For a description of this member, see M:System.IConvertible.ToSingle(System.IFormatProvider).

Parameters
providerThis parameter is ignored.
Returns
The value of the current instance, converted to a T:System.Single.

Implements System.IConvertible.

Definition at line 399 of file SByte.cs.

◆ ToString() [1/4]

override string System.SByte.ToString ( )

Converts the numeric value of this instance to its equivalent string representation.

Returns
The string representation of the value of this instance, consisting of a negative sign if the value is negative, and a sequence of digits ranging from 0 to 9 with no leading zeroes.

Definition at line 90 of file SByte.cs.

◆ ToString() [2/4]

string System.SByte.ToString ( IFormatProvider  provider)

Converts the numeric value of this instance to its equivalent string representation using the specified culture-specific format information.

Parameters
providerAn object that supplies culture-specific formatting information.
Returns
The string representation of the value of this instance, as specified by provider .

Implements System.IConvertible.

Definition at line 100 of file SByte.cs.

◆ ToString() [3/4]

string System.SByte.ToString ( string  format)

Converts the numeric value of this instance to its equivalent string representation, using the specified format.

Parameters
formatA standard or custom numeric format string.
Returns
The string representation of the value of this instance as specified by format .
Exceptions
T:System.FormatExceptionformat is invalid.

Definition at line 111 of file SByte.cs.

◆ ToString() [4/4]

string System.SByte.ToString ( string  format,
IFormatProvider  provider 
)

Converts the numeric value of this instance to its equivalent string representation using the specified format and culture-specific format information.

Parameters
formatA standard or custom numeric format string.
providerAn object that supplies culture-specific formatting information.
Returns
The string representation of the value of this instance as specified by format and provider .
Exceptions
T:System.FormatExceptionformat is invalid.

Implements System.IFormattable.

Definition at line 123 of file SByte.cs.

◆ ToType()

object IConvertible. System.SByte.ToType ( Type  type,
IFormatProvider  provider 
)

For a description of this member, see M:System.IConvertible.ToType(System.Type,System.IFormatProvider).

Parameters
typeThe T:System.Type to which to convert this T:System.SByte value.
providerA T:System.IFormatProvider implementation that provides information about the format of the returned value.
Returns
The value of the current instance, converted to an object of type type .

Implements System.IConvertible.

Definition at line 437 of file SByte.cs.

◆ ToUInt16()

ushort IConvertible. System.SByte.ToUInt16 ( IFormatProvider  provider)

For a description of this member, see M:System.IConvertible.ToUInt16(System.IFormatProvider).

Parameters
providerThis parameter is ignored.
Returns
The value of the current instance, converted to a T:System.UInt16.

Implements System.IConvertible.

Definition at line 354 of file SByte.cs.

◆ ToUInt32()

uint IConvertible. System.SByte.ToUInt32 ( IFormatProvider  provider)

For a description of this member, see M:System.IConvertible.ToUInt32(System.IFormatProvider).

Parameters
providerThis parameter is ignored.
Returns
The value of the current instance, converted to a T:System.UInt32.

Implements System.IConvertible.

Definition at line 372 of file SByte.cs.

◆ ToUInt64()

ulong IConvertible. System.SByte.ToUInt64 ( IFormatProvider  provider)

For a description of this member, see M:System.IConvertible.ToUInt64(System.IFormatProvider).

Parameters
providerThis parameter is ignored.
Returns
The value of the current instance, converted to a T:System.UInt64.

Implements System.IConvertible.

Definition at line 390 of file SByte.cs.

◆ TryParse() [1/2]

static bool System.SByte.TryParse ( string  s,
out sbyte  result 
)
static

Tries to convert the string representation of a number to its T:System.SByte equivalent, and returns a value that indicates whether the conversion succeeded.

Parameters
sA string that contains a number to convert.
resultWhen this method returns, contains the 8-bit signed integer value that is equivalent to the number contained in s if the conversion succeeded, or zero if the conversion failed. The conversion fails if the s parameter is null or F:System.String.Empty, is not in the correct format, or represents a number that is less than F:System.SByte.MinValue or greater than F:System.SByte.MaxValue. This parameter is passed uninitialized; any value originally supplied in result will be overwritten.
Returns
true if s was converted successfully; otherwise, false.

Definition at line 250 of file SByte.cs.

◆ TryParse() [2/2]

static bool System.SByte.TryParse ( string  s,
NumberStyles  style,
IFormatProvider  provider,
out sbyte  result 
)
static

Tries to convert the string representation of a number in a specified style and culture-specific format to its T:System.SByte equivalent, and returns a value that indicates whether the conversion succeeded.

Parameters
sA string representing a number to convert.
styleA bitwise combination of enumeration values that indicates the permitted format of s . A typical value to specify is F:System.Globalization.NumberStyles.Integer.
providerAn object that supplies culture-specific formatting information about s .
resultWhen this method returns, contains the 8-bit signed integer value equivalent to the number contained in s , if the conversion succeeded, or zero if the conversion failed. The conversion fails if the s parameter is null or F:System.String.Empty, is not in a format compliant with style , or represents a number less than F:System.SByte.MinValue or greater than F:System.SByte.MaxValue. This parameter is passed uninitialized; any value originally supplied in result will be overwritten.
Returns
true if s was converted successfully; otherwise, false.
Exceptions
T:System.ArgumentExceptionstyle is not a T:System.Globalization.NumberStyles value. -or- style is not a combination of F:System.Globalization.NumberStyles.AllowHexSpecifier and F:System.Globalization.NumberStyles.HexNumber values.

Definition at line 267 of file SByte.cs.

Member Data Documentation

◆ MaxValue

const sbyte System.SByte.MaxValue = 127

Represents the largest possible value of T:System.SByte. This field is constant.

Definition at line 19 of file SByte.cs.

◆ MinValue

const sbyte System.SByte.MinValue = -128

Represents the smallest possible value of T:System.SByte. This field is constant.

Definition at line 23 of file SByte.cs.


The documentation for this struct was generated from the following file: