Try to cast the current instance to the given type. The cast is dynamically tested for safety.

C# | Visual Basic | Visual C++ |
public static TInstance SafeCastAs<TInstance>( this Id id ) where TInstance : class, IManagedWrapper
<ExtensionAttribute> _ Public Shared Function SafeCastAs(Of TInstance As {Class, IManagedWrapper}) ( _ id As Id _ ) As TInstance
[ExtensionAttribute] public: generic<typename TInstance> where TInstance : ref class, IManagedWrapper static TInstance SafeCastAs( Id^ id )

- TInstance
- The type of the instance.

- id (Id)
[Missing <param name="id"/> documentation for "M:Monobjc.IdExtensions.SafeCastAs``1(Monobjc.Id)"]

The cast instance or null if the cast is not valid or if the reference is null

In Visual Basic and C#, you can call this method as an instance method on any object of type Id. When you use instance method syntax to call this method, omit the first parameter.

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