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
- 繼承
- 屬性
備註
呼叫者可以將 a SupportedOSPlatformGuardAttribute 套用到欄位、屬性或方法,並以條件句或斷言形式使用該成員,安全地呼叫平台專屬的 API。 欄位或屬性型別,或方法回傳型別必須是布林值。
常見的月台名稱包括 android、 browser、 freebsd、 ioswasimacoswindowslinuxmaccatalysttvoswatchos和 。 對於支援版本檢查的平台,平台名稱可以包含版本,例如 windows10.0。 欲了解更多資訊,請參閱 平台相容性分析器。
建構函式
| 名稱 | Description |
|---|---|
| SupportedOSPlatformGuardAttribute(String) |
初始化指定支援作業系統平台的屬性類別新實例 SupportedOSPlatformGuardAttribute 。 |
屬性
| 名稱 | Description |
|---|---|
| PlatformName |
會取得該屬性所適用的平台名稱和可選版本。 (繼承來源 OSPlatformAttribute) |
| TypeId |
在衍生類別中實作時,取得這個 Attribute的唯一標識碼。 (繼承來源 Attribute) |
方法
| 名稱 | Description |
|---|---|
| Equals(Object) |
傳回值,這個值表示這個實例是否等於指定的物件。 (繼承來源 Attribute) |
| GetHashCode() |
傳回這個實例的哈希碼。 (繼承來源 Attribute) |
| GetType() |
取得目前實例的 Type。 (繼承來源 Object) |
| IsDefaultAttribute() |
在衍生類別中覆寫時,指出這個實例的值是否為衍生類別的預設值。 (繼承來源 Attribute) |
| Match(Object) |
在衍生類別中覆寫時,傳回值,指出這個實例是否等於指定的物件。 (繼承來源 Attribute) |
| MemberwiseClone() |
建立目前 Object的淺層複本。 (繼承來源 Object) |
| ToString() |
傳回表示目前 物件的字串。 (繼承來源 Object) |