MonobjcMonobjc Documented Class Library
SafeAutorelease<(Of <(<'T>)>)> Method (instance)
NamespacesMonobjcIdExtensionsSafeAutorelease<(Of <<'(T>)>>)(T)

Performs a safe autorelease operation on the given instance.

The equivalent code is:

if (instance != null) instance.Release(); return instance;
Declaration Syntax
C#Visual BasicVisual C++
public static T SafeAutorelease<T>(
	this T instance
where T : Id
<ExtensionAttribute> _
Public Shared Function SafeAutorelease(Of T As Id) ( _
	instance As T _
) As T
generic<typename T>
where T : Id
static T SafeAutorelease(
	T instance
Generic Template Parameters
The type of the instance
instance (T)
The instance.
Return Value
The instance autoreleased or null if instance was null
Usage Note
In Visual Basic and C#, you can call this method as an instance method on any object of type . 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)