Family of Integers : Integer Family « Data Type « C# / CSharp Tutorial

Home
C# / CSharp Tutorial
1.Language Basics
2.Data Type
3.Operator
4.Statement
5.String
6.struct
7.Class
8.Operator Overload
9.delegate
10.Attribute
11.Data Structure
12.Assembly
13.Date Time
14.Development
15.File Directory Stream
16.Preprocessing Directives
17.Regular Expression
18.Generic
19.Reflection
20.Thread
21.I18N Internationalization
22.LINQ
23.GUI Windows Forms
24.Windows Presentation Foundation
25.Windows Communication Foundation
26.Workflow
27.2D
28.Design Patterns
29.Windows
30.XML
31.XML LINQ
32.ADO.Net
33.Network
34.Directory Services
35.Security
36.unsafe
C# / C Sharp
C# / C Sharp by API
C# / CSharp Open Source
C# / CSharp Tutorial » Data Type » Integer Family 
2.4.1.Family of Integers

C# defines nine integer types:

  1. char,
  2. byte,
  3. sbyte,
  4. short,
  5. ushort,
  6. int,
  7. uint,
  8. long,
  9. ulong.

char type is used for representing characters

The integer structures are

  1. Byte
  2. SByte
  3. Int16
  4. UInt16
  5. Int32
  6. UInt32
  7. Int64
  8. UInt64

The integer structures also define the following const fields:

  1. MaxValue
  2. MinValue

Methods Supported by the Integer Structures

MethodMeaning
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:

  1. IComparable,
  2. IConvertible, and
  3. IFormattable.
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
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.