Casts an instance to the given type.

C# | Visual Basic | Visual C++ |
public static T CastAs<T>( Id instance ) where T : class, IManagedWrapper
Public Shared Function CastAs(Of T As {Class, IManagedWrapper}) ( _ instance As Id _ ) As T
public: generic<typename T> where T : ref class, IManagedWrapper static T CastAs( Id^ instance )

- T
- The parametric type.

- instance (Id)
- The instance.

A cast instance, or null if the cast is invalid.

- Available in Monobjc Bridge: 10.6 (For Mac OS X 10.6 and later), 10.5 (For Mac OS X 10.5 and later)