![Trending Articles on Technical and Non Technical topics](/images/trending_categories.jpeg)
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
What is the difference between int and Int32 in C#?
Int32 is a type provided by .NET framework whereas int is an alias for Int32 in C# language.
Int32 x = 5;
int x = 5;
So, in use both the above statements will hold a 32bit integer. They compile to the same code, so at execution time there is no difference whatsoever.
The only minor difference is Int32 can be only used with System namespace. While validating the type of a value like mentioned above we can use Int32 or int.
typeof(int) == typeof(Int32) == typeof(System.Int32)
Example
The below example shows how an integer is declared using System.Int32.
using System; namespace DemoApplication{ class Program{ static void Main(string[] args){ Int32 x = 5; Console.WriteLine(x); //Output: 5 } } }
Output
5
Example
The below example shows how an integer is declared using int keyword.
using System; namespace DemoApplication{ class Program{ static void Main(string[] args){ int x = 5; Console.WriteLine(x); //Output: 5 } } }
Output
5
Advertisements