Show that using an instance of the System.Int32 stucture is the same as using the int keyword in CSharp

Description

The following code shows how to show that using an instance of the System.Int32 stucture is the same as using the int keyword.

Example


  //from  w w  w  .j  a v a 2 s .  c  om
    using System;
    
    public class TestInt
    {
        static public void Main ()
        {
           System.Int32 x;
           OutInt (out x);
           Console.WriteLine ("The integer is " + x);
           x = 42;
           ShowInt (x);
           ChangeInt (ref x);
           Console.WriteLine ("The integer is " + x);
        }
        static void OutInt (out int val)
        {
            val = 42;
        }
        static void ShowInt (int val)
        {
           Console.WriteLine ("The value passed is " + val.ToString());
        }
        static void ChangeInt (ref System.Int32 val)
        {
            val *= 2;
        }
    }

The code above generates the following result.





















Home »
  C# Tutorial »
    Data Types »




C# Data Types
Bool
Byte
Char
Decimal
Double
Float
Integer
Long
Short
String
C# Array
Array Example
Byte Array
C# Standard Data Type Format
BigInteger
Complex
Currency
DateTime
DateTimeOffset
DateTime Format Parse Convert
TimeSpan
TimeZone
Enum
Null
tuple
var