SupportedOSPlatformGuardAttribute クラス
定義
重要
一部の情報は、リリース前に大きく変更される可能性があるプレリリースされた製品に関するものです。 Microsoft は、ここに記載されている情報について、明示または黙示を問わず、一切保証しません。
サポートされているプラットフォーム名とオプションのバージョンを使用して、カスタム ガード フィールド、プロパティ、またはメソッドに注釈を付けます。 複数の属性を適用して、サポートされている複数のプラットフォームのガードを示すことができます。
public ref class SupportedOSPlatformGuardAttribute sealed : System::Runtime::Versioning::OSPlatformAttribute
[System.AttributeUsage(System.AttributeTargets.Field | System.AttributeTargets.Method | System.AttributeTargets.Property, AllowMultiple=true, Inherited=false)]
public sealed class SupportedOSPlatformGuardAttribute : System.Runtime.Versioning.OSPlatformAttribute
[<System.AttributeUsage(System.AttributeTargets.Field | System.AttributeTargets.Method | System.AttributeTargets.Property, AllowMultiple=true, Inherited=false)>]
type SupportedOSPlatformGuardAttribute = class
inherit OSPlatformAttribute
Public NotInheritable Class SupportedOSPlatformGuardAttribute
Inherits OSPlatformAttribute
- 継承
- 属性
注釈
呼び出し元は、フィールド、プロパティ、またはメソッドに SupportedOSPlatformGuardAttribute を適用し、条件付きまたはアサーションでそのメンバーを使用して、プラットフォーム固有の API を安全に呼び出すことができます。 フィールドまたはプロパティの型、またはメソッドの戻り値の型はブール型である必要があります。
一般的なプラットフォーム名には、 android、 browser、 freebsd、 ios、 linux、 macos、 maccatalyst、 tvos、 wasi、 watchos、 windowsが含まれます。 バージョン チェックをサポートするプラットフォームの場合、プラットフォーム名には、 windows10.0などのバージョンを含めることができます。 詳細については、 プラットフォーム互換性アナライザーを参照してください。
コンストラクター
| Name | 説明 |
|---|---|
| SupportedOSPlatformGuardAttribute(String) |
指定したサポートされている OS プラットフォームの SupportedOSPlatformGuardAttribute 属性クラスの新しいインスタンスを初期化します。 |
プロパティ
| Name | 説明 |
|---|---|
| PlatformName |
属性が適用されるプラットフォームの名前と省略可能なバージョンを取得します。 (継承元 OSPlatformAttribute) |
| TypeId |
派生クラスで実装されている場合は、この Attributeの一意の識別子を取得します。 (継承元 Attribute) |
メソッド
| Name | 説明 |
|---|---|
| Equals(Object) |
このインスタンスが指定したオブジェクトと等しいかどうかを示す値を返します。 (継承元 Attribute) |
| GetHashCode() |
このインスタンスのハッシュ コードを返します。 (継承元 Attribute) |
| GetType() |
現在のインスタンスの Type を取得します。 (継承元 Object) |
| IsDefaultAttribute() |
派生クラスでオーバーライドされた場合、このインスタンスの値が派生クラスの既定値であるかどうかを示します。 (継承元 Attribute) |
| Match(Object) |
派生クラスでオーバーライドされた場合、このインスタンスが指定したオブジェクトと等しいかどうかを示す値を返します。 (継承元 Attribute) |
| MemberwiseClone() |
現在の Objectの簡易コピーを作成します。 (継承元 Object) |
| ToString() |
現在のオブジェクトを表す文字列を返します。 (継承元 Object) |