Edytuj

Udostępnij za pośrednictwem


ReleaseAttribute Class

Definition

This attribute indicates that the return value of a function is retained (the caller obtains a reference to the object returned).

[System.AttributeUsage(System.AttributeTargets.ReturnValue)]
public sealed class ReleaseAttribute : Attribute
type ReleaseAttribute = class
    inherit Attribute
Inheritance
ReleaseAttribute
Attributes

Remarks

The Xamarin.iOS runtime uses this attribute to determine the reference counting behavior on the boundary between Objective-C and managed code.

class MyUrl : NSUrl { // NSUrl implements NSCopying
  public override NSObject Clone ()
  {
    return base.Clone ();
  }
}

In this example Xamarin.iOS will first call 'release' on the object returned by [NSUrl clone] (the call to base.Clone), then call 'retain' as the object is returned to Objective-C.

Constructors

ReleaseAttribute()

Initializes a new instance of the Release attribute.

Applies to