Edytuj

Udostępnij za pośrednictwem


AvailabilityAttribute Class

Definition

Caution

Use [Introduced|Deprecated|Obsoleted|Unavailable] attributes with PlatformName.

Describes the availability of a member or type in iOS or macOS.

[System.AttributeUsage(System.AttributeTargets.All, AllowMultiple=true)]
[System.Obsolete("Use [Introduced|Deprecated|Obsoleted|Unavailable] attributes with PlatformName.")]
public class AvailabilityAttribute : Attribute
type AvailabilityAttribute = class
    inherit Attribute
Inheritance
AvailabilityAttribute
Derived
Attributes

Remarks

This attribute is used to annotate when a type or member of a type was introduced, deprecated, obsolete or is unavailable. This is done on a per-platform basis (currently macOS and iOS).

The information is only accurate for active versions of the operating systems, the information is removed as soon as operating systems are deprecated or no longer supported by Apple.

It is the managed equivalent of Clang's availability __attribute__, which is the underlying mechanism that Apple uses to perform these annotations.

This attribute is obsolete, it's superceded by IntroducedAttribute, DeprecatedAttribute, ObsoletedAttribute and UnavailableAttribute (which support tvOS and watchOS as well).

Constructors

AvailabilityAttribute()

Default constructor, sets not availability.

AvailabilityAttribute(Platform, Platform, Platform, Platform)

Defines the availability range of a particular API.

Properties

AlwaysAvailable

Indicates that the member or type can be assumed to always be available (on both macOS and iOS, as well as every version that is currently supported).

Deprecated

The first version in which the API was deprecated for a given platform; this means users should begin avoiding the API and migrating to a more suitable one, but it still technically works on the platform, but there is no guarantee for how long it will continue to work.

DeprecatedArchitecture

Indicates the platforms on which the member or type has been deprecated.

DeprecatedVersion

Indicates the platforms on which the member or type has been deprecated.

Introduced

The first version in which an API was introduced for a given platform.

IntroducedArchitecture

The architectures on which the introduced version applies to.

IntroducedVersion

Indicates the versions on API the feature was introduced.

Message

The message describing any limitations.

Obsoleted

The first version in which the API was obsoleted from a given platform

ObsoletedArchitecture

The architectures the obsoleted version applies to.

ObsoletedVersion

Indicates the version in which the API was obsoleted.

Unavailable

The API does currently not exist on a given platform.

Methods

Get(MemberInfo)

Convenience method to fetch the AvailabilityAttribute from a MemberInfo.

Merge(IEnumerable<Object>)

Returns an availability attribute that is made up of the merged Introduced, Obsoleted, Deprecated and Unavailable properties (including a concatenated version of the message attribute).

ToString()

Returns a human readable version of the availability attribute.

Applies to