Monday, June 20, 2005

 

A simple typeof operator

Just a simple typeof operator:
using System;
using System.IO;

class UseTypeof
{
public static void Main()
{
Type t = typeof(StreamReader);

Console.WriteLine(t.FullName);

if (t.IsClass)
Console.WriteLine("Is a class");
if (t.IsAbstract)
Console.WriteLine("Is abstract");
else
Console.WriteLine("Is concrete.");
}
}

(Taken from C#: The Complete Reference by Schildt)

Result should be:
System.IO.StreamReader
Is a class
Is concrete.

Comments: Post a Comment

<< Home

This page is powered by Blogger. Isn't yours?