int
In this chapter you will learn:
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:
Home » C# Tutorial » Byte, Integer, Long