C# TypeInfo IsInterface
Description
TypeInfo IsInterface
Gets a value indicating whether
the Type is an interface; that is, not a class or a value type.
Syntax
TypeInfo.IsInterface
has the following syntax.
public bool IsInterface { get; }
Example
The following example creates an interface, checks for the interface type, and indicates whether a class has the IsInterface property set.
//w w w. j a v a2 s .com
using System;
interface myIFace
{
}
class MyIsInterface
{
public static void Main(string []args)
{
bool myBool1 = typeof(myIFace).IsInterface;
Console.WriteLine("Is the specified type an interface? {0}.", myBool1);
bool myBool2 = typeof(MyIsInterface).IsInterface;
Console.WriteLine("Is the specified type an interface? {0}.", myBool2);
}
}
The code above generates the following result.