is operator

is operator tells if a reference is a certain class.


using System;
class Person
{
    public string name;
}
class Employee : Person
{
    public string companyName;
}

class Program
{
    static void Main(string[] args)
    {
        Person p = new Employee();

        Console.WriteLine(p is Employee);
    }
}

The output:


True
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.