C# | Int32 Struct - GeeksforGeeks

02 May, 2019
In C#, Int32 Struct represents 32-bit signed integer(also termed as int data type) starting from range -2,147,483,648 to +2,147,483,647. It also provides different types of method to perform various operations. You can perform the mathematical operation like addition, subtraction, multiplication, etc. on Int32 type. It supports bitwise operations like AND, OR, XOR, etc. It provides full support for standard and custom numeric format strings. You can call the methods of Convert and Math class to perform operations on Int32 value. Int32 struct inherits the ValueType class which inherits the Object class.
Example:
// C# program to illustrate the // MaxValue and MinValue fieldusing System;  class GFG {      // Main method    static public void Main()    {        Int32 var1 = 34;        Int32 var2 = 30;        Int32 var3 = 59;          // Get the Maximum and Minimum value         // of Int32 type Using MaxValue and         // MinValue field        Console.WriteLine("Value 1: {0}", var1);        Console.WriteLine("Value 2: {0}", var2);        Console.WriteLine("Value 3: {0}", var3);          Console.WriteLine("Maximum Value: {0}",                               Int32.MaxValue);          Console.WriteLine("Minimum Value: {0}",                               Int32.MinValue);    }}
Value 1: 34
Value 2: 30
Value 3: 59
Maximum Value: 2147483647
Minimum Value: -2147483648

Example 1:
// C# program to demonstrate the // Int32.Equals(Object) Method using System; using System.Globalization;   class GFG {       // Main Method     public static void Main()     {         // Declaring and initializing value1         int value1 = 70;           // Declaring and initializing value2         object value2 = 89;           // using Equals(object) method         bool status = value1.Equals(value2);           // checking the status         if (status)             Console.WriteLine("{0} is equal to {1}",                                 value1, value2);         else            Console.WriteLine("{0} is not equal to {1}",                             value1, value2);     } } 
70 is not equal to 89

Example 2:
// C# program to illustrate the // GetTypeCode() methodusing System;  class GFG {      // Main method    static public void Main()    {        Int32 var1 = 100;        Int32 var2 = 403;        Int32 var3 = 503;          // Get the type code of        // all the variables        // Using GetTypeCode() method        Console.WriteLine("Get the type code of var1: {0}",                                       var1.GetTypeCode());          Console.WriteLine("Get the type code of var2: {0}",                                       var2.GetTypeCode());          Console.WriteLine("Get the type code of var3: {0}",                                       var3.GetTypeCode());    }}
Get the type code of var1: Int32
Get the type code of var2: Int32
Get the type code of var3: Int32

Reference:
https://docs.microsoft.com/en-us/dotnet/api/system.int32?view=netframework-4.7.2
CSharp-Int32-Struct
C#
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Destructors in C#
Difference between Ref and Out keywords in C#
C# | Delegates
C# | Constructors
C# | Class and Object
C# | String.IndexOf( ) Method | Set - 1
Introduction to .NET Framework
Extension Method in C#
C# | Abstract Classes
C# | Data Types