Mac Guides | Samples

MonoMac.Foundation.ModelAttribute Class

Flag a class as a model.

See Also: ModelAttribute

Syntax

[System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Interface | System.AttributeTargets.All)]
public sealed class ModelAttribute : Attribute

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. There are two ways of implementing a model, you can either implement it manually or use the existing strongly typed definitions.

MonoMac provides already strongly typed declarations ready to use that do not require manual binding. To support this programming model, the MonoMac runtime supports the [Model] attribute on a class declaration. This informs the runtime that it should not wire up all the methods in the class, unless the method is explicitly implemented.

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 MonoMac 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 he is interested in.

Requirements

Namespace: MonoMac.Foundation
Assembly: XamMac (in XamMac.dll)
Assembly Versions: 0.0.0.0

The members of MonoMac.Foundation.ModelAttribute are listed below.

See Also: Attribute

Public Constructors

Default constructor.