Sitecore 5.0 API

MainUtil.IsType Method 

Checks if an object is of a given type

[Visual Basic]
Public Shared Function IsType( _
   ByVal obj As Object, _
   ByVal type As Type _
) As Boolean
[C#]
public static bool IsType(
   object obj,
   Type type
);

Parameters

obj
An object.
type
A type.

Return Value

True if the object is of the type, otherwise false.

Remarks

This function is analog to the "is" operator.

The function performs the following checks:

  1. Is the type of object equivalent to the type.
  2. Is the object a subclass of the type.
  3. If the type is an interface, does the object implement it.

See Also

MainUtil Class | Sitecore Namespace