Switch.GetSupportedAttributes メソッド
アセンブリ: System (system.dll 内)

Dim returnValue As String() returnValue = Me.GetSupportedAttributes
スイッチによってサポートされるカスタム属性の名前を含む文字列配列。カスタム属性がサポートされない場合は null 参照 (Visual Basic では Nothing)。

GetSupportedAttributes メソッドの既定の実装では null 参照 (Visual Basic では Nothing) を返します。スイッチが構成ファイルに追加され、GetSupportedAttributes によって返された文字列配列に含まれていないカスタム属性が指定されると、スイッチが読み込まれるときに ConfigurationException がスローされます。
継承時の注意 Switch クラスまたは派生クラスから継承する場合は、GetSupportedAttributes メソッドをオーバーライドしてクラスのカスタム属性を提供できます。
カスタム スイッチの GetSupportedAttributes メソッドのオーバーライドを次のコード例に示します。
Public Class MySourceSwitch Inherits SourceSwitch Private sourceAttribute As Integer = 0 Public Sub New(ByVal n As String) MyBase.New(n) End Sub 'New Public Property CustomSourceSwitchAttribute() As Integer Get Dim de As DictionaryEntry For Each de In Me.Attributes If de.Key.ToString().ToLower() = "customsourceswitchattribute" Then sourceAttribute = Fix(de.Value) End If Next de Return sourceAttribute End Get Set(ByVal value As Integer) sourceAttribute = Fix(Value) End Set End Property Protected Overrides Function GetSupportedAttributes() As String() Return New String() {"customsourceSwitchattribute"} End Function 'GetSupportedAttributes End Class 'MySourceSwitch
public class MySourceSwitch : SourceSwitch { int sourceAttribute = 0; public MySourceSwitch(string n) : base(n) { } public int CustomSourceSwitchAttribute { get { foreach (DictionaryEntry de in this.Attributes) if (de.Key.ToString().ToLower() == "customsourceswitchattribute") sourceAttribute = (int)de.Value; return sourceAttribute; } set { sourceAttribute = (int)value; } } protected override string[] GetSupportedAttributes() { return new string[] { "customsourceSwitchattribute" }; } }

Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


Weblioに収録されているすべての辞書からSwitch.GetSupportedAttributes メソッドを検索する場合は、下記のリンクをクリックしてください。

- Switch.GetSupportedAttributes メソッドのページへのリンク