ModelAttribute 類別
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
將類別或介面標記為模型,表示只有明確覆寫的方法會暴露於 Objective-C 執行時。
[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
- 繼承
-
ModelAttribute
- 屬性
備註
Objective-C 協定類似介面,但支援可選方法,也就是說,協定運作時並非所有方法都必須實作。
[Model] 屬性套用到可選擇方法的類別,通常用於宣告包含多個可選方法的 Objective-C 代理或資料模型。 執行時會特別處理套用 Model 屬性的類別:只有當使用者覆蓋類別中的方法時,該覆蓋才會被 Objective-C 世界視為存在。
此屬性用於所有模型與代理類別,讓使用者只能實作他們感興趣的方法。
建構函式
| 名稱 | Description |
|---|---|
| ModelAttribute() |
初始化 ModelAttribute 類別的新執行個體。 |
屬性
| 名稱 | Description |
|---|---|
| Name |
取得或設定模型的 Objective-C 型別名稱。 |