TraceSource.GetSupportedAttributes メソッドとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > TraceSource.GetSupportedAttributes メソッドの意味・解説 

TraceSource.GetSupportedAttributes メソッド

メモ : このメソッドは、.NET Framework version 2.0新しく追加されたものです。

トレース ソースによってサポートされカスタム属性取得します

名前空間: System.Diagnostics
アセンブリ: System (system.dll 内)
構文構文

解説解説

GetSupportedAttributes既定実装では、null 参照 (Visual Basic では Nothing) が返されます。

継承時の注意 TraceSource クラスまたは派生クラスから継承する場合は、GetSupportedAttributes メソッドオーバーライドしてクラスカスタム属性を提供できます

使用例使用例

MyTraceSource クラスカスタム属性識別するGetSupportedAttributes メソッドオーバーライド次のコード例示します

Public Class MyTraceSource
    Inherits TraceSource
    Private firstAttribute As String
 = ""
    Private secondAttribute As String
 = ""

    Public Sub New(ByVal
 n As String)
        MyBase.New(n)

    End Sub 'New 

    Public Property FirstTraceSourceAttribute()
 As String
        Get
            Dim de As DictionaryEntry
            For Each de In
 Me.Attributes
                If de.Key.ToString().ToLower() = "firsttracesourceattribute"
 Then
                    firstAttribute = de.Value.ToString()
                End If
            Next de
            Return firstAttribute
        End Get
        Set(ByVal value As
 String)
            firstAttribute = value
        End Set
    End Property

    Public Property SecondTraceSourceAttribute()
 As String
        Get
            Dim de As DictionaryEntry
            For Each de In
 Me.Attributes
                If de.Key.ToString().ToLower() = "secondtracesourceattribute"
 Then
                    secondAttribute = de.Value.ToString()
                End If
            Next de
            Return secondAttribute
        End Get
        Set(ByVal value As
 String)
            secondAttribute = Value
        End Set
    End Property

    Protected Overrides Function
 GetSupportedAttributes() As String()
        ' Allow the use of the attributes in the configuration file.
        Return New String()
 {"FirstTraceSourceAttribute", "SecondTraceSourceAttribute"}

    End Function 'GetSupportedAttributes
End Class 'MyTraceSource 
public class MyTraceSource : TraceSource
{
    string firstAttribute = "";
    string secondAttribute = "";
    public MyTraceSource(string n) : base(n)
 {}

    public string FirstTraceSourceAttribute
    {
        get {
            foreach (DictionaryEntry de in
 this.Attributes)
                if (de.Key.ToString().ToLower() == "firsttracesourceattribute")
                    firstAttribute = de.Value.ToString() ; 
            return firstAttribute;
        }
        set { firstAttribute = value; }
    }

    public string SecondTraceSourceAttribute
    {
        get {
            foreach (DictionaryEntry de in
 this.Attributes)
                if (de.Key.ToString().ToLower() == "secondtracesourceattribute")
                    secondAttribute = de.Value.ToString();
            return secondAttribute; }
        set { secondAttribute = value; }
    }

    protected override string[] GetSupportedAttributes()
    {
        // Allow the use of the attributes in the configuration file.
        return new string[]
 { "FirstTraceSourceAttribute", "SecondTraceSourceAttribute"
 };
    }
}
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照


このページでは「.NET Framework クラス ライブラリ リファレンス」からTraceSource.GetSupportedAttributes メソッドを検索した結果を表示しています。
Weblioに収録されているすべての辞書からTraceSource.GetSupportedAttributes メソッドを検索する場合は、下記のリンクをクリックしてください。
 全ての辞書からTraceSource.GetSupportedAttributes メソッド を検索

英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

TraceSource.GetSupportedAttributes メソッドのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



TraceSource.GetSupportedAttributes メソッドのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2025 Microsoft.All rights reserved.

©2025 GRAS Group, Inc.RSS