MonobjcMonobjc Documented Class Library
SafeCastAs<(Of <(<'TInstance>)>)> Method (id)
NamespacesMonobjcIdExtensionsSafeCastAs<(Of <<'(TInstance>)>>)(Id)
Try to cast the current instance to the given type. The cast is dynamically tested for safety.
Declaration Syntax
C#Visual BasicVisual 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
generic<typename TInstance>
where TInstance : ref class, IManagedWrapper
static TInstance SafeCastAs(
	Id^ id
Generic Template Parameters
The type of the instance.
id (Id)

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

Return Value
The cast instance or null if the cast is not valid or if the reference is null
Usage Note
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.
Version Information
  • Available in Monobjc Bridge: 10.6 (For Mac OS X 10.6 and later), 10.5 (For Mac OS X 10.5 and later)

Assembly: Monobjc (Module: Monobjc)