MonobjcMonobjc Documented Class Library
SafeCastTo<(Of <(<'TInstance>)>)> Method (id)
NamespacesMonobjcIdExtensionsSafeCastTo<(Of <<'(TInstance>)>>)(Id)
Cast the current instance to the given type. the cast is dynamically tested for safety
Declaration Syntax
C#Visual BasicVisual C++
public static TInstance SafeCastTo<TInstance>(
	this Id id
)
where TInstance : class, IManagedWrapper
<ExtensionAttribute> _
Public Shared Function SafeCastTo(Of TInstance As {Class, IManagedWrapper}) ( _
	id As Id _
) As TInstance
[ExtensionAttribute]
public:
generic<typename TInstance>
where TInstance : ref class, IManagedWrapper
static TInstance SafeCastTo(
	Id^ id
)
Generic Template Parameters
TInstance
The type of the instance.
Parameters
id (Id)

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

Return Value
The cast instance or null 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.
Exceptions
ExceptionCondition
ObjectiveCClassCastExceptionIf an error occured during the cast
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)