Language

ModelAttribute Class

Definition

Flags a class or interface as a model, indicating that only explicitly overridden methods are exposed to the Objective-C runtime.

[System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Interface)]
public sealed class ModelAttribute : Attribute
[<System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Interface)>]
type ModelAttribute = class
    inherit Attribute
Inheritance
ModelAttribute
Attributes

Remarks

Objective-C protocols are like interfaces, but they support optional methods, that is, not all of the methods need to be implemented for the protocol to work.

The [Model] attribute is applied to a class that can have optional methods, and it is typically used for declaring Objective-C delegates or data models that have a number of optional methods. The runtime treats classes with the Model attribute applied specially: only when a user overrides methods in a class is the actual override exposed to the Objective-C world as existing.

This attribute is used in all of the models and delegate classes to allow the user to only implement the methods that they are interested in.

Constructors

Name Description
ModelAttribute()

Initializes a new instance of the ModelAttribute class.

Properties

Name Description
Name

Gets or sets the Objective-C type name for the model.

Applies to