Nano's Blog

03/08/2010

Typeof() and GetType() in C#

Filed under: programming — Tags: — nano @ 02:05
using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;

namespace testNameSpace
{

    class testClass
    {
        public static void Main()
        {
            System.Type type0 = typeof(int);
            Console.WriteLine("{0}", type0);

            int i = 0;
            System.Type type1 = i.GetType();
            Console.WriteLine("{0}", type1);

        }
    }
}

output

System.Int32
System.Int32

More:
MSDN : http://msdn.microsoft.com/en-us/library/58918ffs(VS.80).aspx

No Comments »

No comments yet.

RSS feed for comments on this post. TrackBack URL

Leave a comment

Powered by WordPress