Use 'is' for int value type : Integer Family « Data Type « C# / CSharp Tutorial






using System;

public class MainClass
{
    static void Main() {
        int j = 123;
        object boxed = j;
        object obj = new Object();

        Console.WriteLine( "boxed {0} int", boxed is int ? "is" : "isnot" );
        Console.WriteLine( "obj {0} int", obj is int ? "is" : "isnot" );
        Console.WriteLine( "boxed {0} System.ValueType", boxed is ValueType ? "is" : "isnot" );

    }
}
boxed is int
obj isnot int
boxed is System.ValueType








2.4.Integer Family
2.4.1.Family of Integers
2.4.2.Integer Types
2.4.3.Integer ranges
2.4.4.Use 'is' for int value type
2.4.5.A C# int is a shorthand for System.Int32, which inherits the following members from System.Object
2.4.6.Shifting an integer value