int

In this chapter you will learn:

  1. How to specify int literal
  2. Methods for int type

int literal

To specify a decimal constant, begin the specification with a nonzero digit.

using System;//java2 s  .  c o m

public class MainClass{
    public static void Main() {
        int i = 157;   // Decimal constant
        Console.WriteLine(i);
    }
}

Methods for int type

A C# int is a shorthand for System.Int32, which inherits the following members from System.Object.

using System;//java2  s . c om

class Program
{
  static void Main(string[] args)
  {
    Console.WriteLine("12.GetHashCode() = {0}", 12.GetHashCode());
    Console.WriteLine("12.Equals(23) = {0}", 12.Equals(23));
    Console.WriteLine("12.ToString() = {0}", 12.ToString());
    Console.WriteLine("12.GetType() = {0}", 12.GetType());
  }

}

Next chapter...

What you will learn in the next chapter:

  1. int Max/Min value
  2. Assign value to int value
Home » C# Tutorial » Byte, Integer, Long
Integer Family
Integer ranges
byte
Convert to byte
Parse string to byte
byte format
byte octal and hexadecimal
byte binary operation
byte overflow with unchecked
int
int value
Compare int value
int calculation
int value overflow
int binary operation
Parse string to int value
Format int value
int in binary, octal and hexadecimal
long
long value calculation
ulong