The is operator - CSharp Custom Type

CSharp examples for Custom Type:is

Introduction

The is operator tests whether an object derives from a specified class or implements an interface.

It is often used to test before downcasting:

if (a is Stock)
    Console.WriteLine (((Stock)a).SharesOwned);

Related Tutorials