Support us .Net Basics C# SQL ASP.NET ADO.NET MVC Slides C# Programs Subscribe Buy DVD

Part 12 - Difference between int and Int32 in c#

Suggested Videos:
Part 9 - Call an abstract method from an abstract class constructor
Part 10 - What happens if finally block thows an exception
Part 11 - What is the difference between is and as keyword in c#

This is a very basic and a common c# interview question

Int32 and int are synonymous, both of them allow us to create a 32 bit integer. int is shorthand notation (alias) for Int32. When declaring an integer in a c# program most of us prefer using int over Int32. 

Whether we use int or Int32 to create an integer, the behaviour is identical. 

int i = 10;
Int32 j = 10;

Console.WriteLine("int i = " + i);
Console.WriteLine("Int32 j = " + j);
Console.WriteLine("int i + Int32 j =  " + (i + j));

I think the only place where Int32 is not allowed is when creating an enum. The following code will raise a compiler error stating - Type byte, sbyte, short, ushort, int, uint, long, or ulong expected.
enum Test : Int32
    XXX = 1

The following code will compile just fine
enum Test : int
    XXX = 1

I can think of only the following minor differences between int and Int32
1. One of the difference is in readability. When we use Int32, we are being explicitl about the size of the variable.
2. To use Int32, either we need to use using System declaration or specify the fully qualified name (System.Int32) where as with int it is not required.

If you can think of any other differences, please feel free to leave a comment.

The interviewer may also ask, what is the difference between string and System.String
There is no difference string is an alias for System.String.


  1. Dear Vankat
    In an interview I was asked to Give a practical example of Interface? Why we use interface instead of classes?
    I was know the interface but I can’t answer him because the purpose of interface was not cleared. Kindly upload the answer of this question.

    1. in c# multiple inheritance is not supported by the "classes".
      by using interface instead of class,we can achieve multiple inheritance.
      please study about the multiple inheritance.

  2. Hi

    An interview is taken from me in which the interviewer stuck on DELEGATE, i satisfy him by
    definiation, declaration but when he asked Why we use delegate? give practical example?
    I watch your video i understand but reason and purpose is not cleare me.
    An other Question he asked why we use of Lambda Expression, i was again blank. He also asked about
    Interface uasge and its purpose.
    Please upload a video in which these questions are discussed. i really thank full to you!

  3. Hi Venkat

    int is a C# syntax and INT32 is a Base Class Library syntax. This is a main difference between int and INT32.

  4. Vankat Bro!
    it is mostly asked that when we use delegate and when we use interface?
    please up load the answer

  5. yes this is the only difference i can think of.. int is c# syntax whereas int32 is from base class library of .NET framework


If you like this website, please share with your friends on facebook and Google+ and recommend us on google using the g+1 button on the top right hand corner.