ProtocolAttribute クラス
定義
重要
一部の情報は、リリース前に大きく変更される可能性があるプレリリースされた製品に関するものです。 Microsoft は、ここに記載されている情報について、明示または黙示を問わず、一切保証しません。
Objective-C プロトコルを表すインターフェイスに適用される属性。
[System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Interface)]
public sealed class ProtocolAttribute : Attribute
[<System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Interface)>]
type ProtocolAttribute = class
inherit Attribute
- 継承
-
ProtocolAttribute
- 属性
注釈
Xamarin.iOS は、この属性を持つインターフェイスをプロトコルとして Objective-C にエクスポートします。これらのインターフェイスを実装するすべてのクラスは、Objective-C にエクスポートされるときに対応するプロトコルを実装するとマークされます。
// This will create an Objective-C protocol called 'IMyProtocol', with one required member ('requiredMethod')
[Protocol ("IMyProtocol")]
interface IMyProtocol
{
[Export ("requiredMethod")]
void RequiredMethod ();
}
// This will export the equivalent of "@interface MyClass : NSObject <IMyProtocol>" to Objective-C.
class MyClass : NSObject, IMyProtocol
{
void RequiredMethod ()
{
}
}
コンストラクター
| 名前 | 説明 |
|---|---|
| ProtocolAttribute() |
Objective-C プロトコルを表すインターフェイスに適用される属性。 |
プロパティ
| 名前 | 説明 |
|---|---|
| BackwardsCompatibleCodeGeneration |
このプロパティは、バインディング ジェネレーターが対象のプロトコルに対して下位互換性のあるコードを生成するかどうかを示します。 特に、このプロパティが true の場合、バインディング ジェネレーターは省略可能なメンバーの拡張メソッドを生成し、すべてのプロトコル メンバーのプロトコル インターフェイスで属性を ProtocolMemberAttribute します。 |
| FormalSince |
Objective-C プロトコルを表すインターフェイスに適用される属性。 |
| IsInformal |
Objective-C プロトコルが非公式のプロトコルであるかどうか。 |
| Name |
プロトコルの名前。 |
| WrapperType |
このプロトコルのインスタンスをラップするために使用できる特定のマネージド型。 |