Struct SByte
Represents an 8-bit signed integer.
Inherited Members
Namespace: System
Assembly: mscorlib.dll
Syntax
[CLSCompliant(false)]
public struct SByte
Fields
| Improve this Doc View SourceMaxValue
Represents the largest possible value of SByte. This field is constant.
Declaration
public const sbyte MaxValue = 127
Field Value
Type | Description |
---|---|
SByte |
Remarks
The value of this constant is 127; that is, hexadecimal 0x7F.
MinValue
Represents the smallest possible value of SByte. This field is constant.
Declaration
public const sbyte MinValue = -128
Field Value
Type | Description |
---|---|
SByte |
Remarks
The value of this constant is -128; that is, hexadecimal 0x80.
Methods
| Improve this Doc View SourceParse(String)
Converts the string representation of a number to its 8-bit signed integer equivalent.
Declaration
[CLSCompliant(false)]
public static sbyte Parse(string s)
Parameters
Type | Name | Description |
---|---|---|
String | s | A string that represents a number to convert. The string is interpreted using the NumberStyles.Integer style. |
Returns
Type | Description |
---|---|
SByte | An 8-bit signed integer that is equivalent to the number contained in the s parameter. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException |
|
ToString()
Converts the numeric value of this instance to its equivalent string representation.
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
String | 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. |
Overrides
| Improve this Doc View SourceToString(String)
Converts the numeric value of this instance to its equivalent string representation, using the specified format.
Declaration
public string ToString(string format)
Parameters
Type | Name | Description |
---|---|---|
String | format | A standard or custom numeric format string. |
Returns
Type | Description |
---|---|
String | The string representation of the value of this instance as specified by format. |
TryParse(String, out SByte)
Tries to convert the string representation of a number to its SByte equivalent, and returns a value that indicates whether the conversion succeeded.
Declaration
[CLSCompliant(false)]
public static bool TryParse(string s, out sbyte result)
Parameters
Type | Name | Description |
---|---|---|
String | s | A string that contains a number to convert. |
SByte | result | When this method returns, contains the 8-bit signed integer value that is equivalent to the number contained in |
Returns
Type | Description |
---|---|
Boolean | true if |
Remarks
The TryParse(String, out SByte)(String, SByte) method is like the Parse(String)(String) method, except that it does not throw an exception if the conversion fails. This method eliminates the need to use exception handling to test for a FormatException if value is invalid and cannot be successfully parsed.