Object - GetTypeCode

Returns the TypeCode for the specified object.

Try it

public static void Main()
{
    object[] values = { true, 935, 12345678905648, 'x', new DateTime(2009, 5, 12), "One", 16.3e42};
	
	string format = "{0, -30} {1, -15}";
	
	Console.WriteLine(format, "Value", "TypeCode");
	Console.WriteLine(format, "-----", "--------");

    foreach (object value in values)
    {
        //C# Extension Method: Object - GetTypeCode
        Console.WriteLine(format, value, value.GetTypeCode());
    }
}

View Source
using System;

public static partial class Extensions
{
    /// <summary>
    ///     Returns the  for the specified object.
    /// </summary>
    /// <param name="value">An object that implements the  interface.</param>
    /// <returns>The  for , or  if  is null.</returns>
    public static TypeCode GetTypeCode(this Object value)
    {
        return Convert.GetTypeCode(value);
    }
}