C# defines nine integer types:
char type is used for representing characters
The integer structures are
The integer structures also define the following const fields:
Methods Supported by the Integer Structures
Method | Meaning |
public int CompareTo(object v) | Returns 0 if the values are equal. Returns a negative value if the invoking object has a lower value. Returns a positive value if the invoking object has a greater value. |
public override bool Equals(object v) | Returns true if equal. |
public override int GetHashCode() | Returns the hash code. |
public TypeCode GetTypeCode() | Returns the TypeCode enumeration value. For example, for Int32, the type code is TypeCode.Int32. |
public static retType Parse(string str) | Parses the string. |
public static retType Parse(string str,IFormatProvider fmtpvdr) | Parse string using the culture-specific information provided by fmtpvdr. |
public static retType Parse(string str, NumberStyles styles) | Parse string using the style information provided by styles. |
public static retType Parse(string str, NumberStyles styles,IFormatProvider fmtpvdr) | Parse string using the style information provided by styles and the culture-specific format information provided by fmtpvdr. |
public override string ToString() | Convert value to string. |
public string ToString(string format) | Convert value to string as specified by the format string. |
public stringToString(IFormatProvider fmtpvdr) | Returns the string representation of the value of the invoking object using the culture-specific information. |
public stringToString(string format,IFormatProvider fmtpvdr) | Returns the string representation of the value of the invoking object using the culture-specific information and the format. |
All of the integer structures implement the following interfaces:
2.4.Integer Family | ||||
2.4.1. | Family of Integers | |||
2.4.2. | Integer Types | |||
2.4.3. | Integer ranges | |||
2.4.4. | Use 'is' for int value type | |||
2.4.5. | A C# int is a shorthand for System.Int32, which inherits the following members from System.Object | |||
2.4.6. | Shifting an integer value |