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

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

TraceListener.GetSupportedAttributes メソッド

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

トレース リスナによってサポートされるカスタム属性を取得します。

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

Protected Friend Overridable
 Function GetSupportedAttributes As String()
Dim returnValue As String()

returnValue = Me.GetSupportedAttributes
protected internal virtual string[] GetSupportedAttributes
 ()
protected public:
virtual array<String^>^ GetSupportedAttributes ()
protected String[] GetSupportedAttributes ()
protected internal function
 GetSupportedAttributes () : String[]

戻り値
トレース リスナによってサポートされるカスタム属性の名前を付ける文字列配列。カスタム属性がない場合は null 参照 (Visual Basic では Nothing)。

解説解説

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

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

使用例使用例

カスタム トレース リスナに対する GetSupportedAttributes メソッドのオーバーライドを次のコード例に示します。

<HostProtection(Synchronization:=True)> _
Public Class TestListener
    Inherits TextWriterTraceListener

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

    End Sub 'New

    Public Sub New(ByVal
 fileName As String, ByVal
 name As String)
        MyBase.New(fileName, name)

    End Sub 'New

    Public Overrides Sub
 Write(ByVal s As String)
        MyBase.Write(("TestListener "
 + s))

    End Sub 'Write

    Public Overrides Sub
 WriteLine(ByVal s As String)
        MyBase.WriteLine(("TestListener "
 + s))

    End Sub 'WriteLine

    Protected Overrides Function
 GetSupportedAttributes() As String()
        ' The following string array will allow the use of 
        ' the name "customListenerAttribute" in the configuration
 file.
        Return New String()
 {"customListenerAttribute"}

    End Function 'GetSupportedAttributes
End Class 'TestListener 
[HostProtection(Synchronization = true)]
public class TestListener : TextWriterTraceListener
{
    public TestListener(string fileName) :
 base(fileName) { }
    public TestListener(string fileName, string
 name) : base(fileName, name) {}

    public override void Write(string
 s)
    {
        base.Write("TestListener " + s);
    }
    public override void WriteLine(string
 s)
    {
        base.WriteLine("TestListener " + s);
    }
    protected override string[] GetSupportedAttributes()
    {
        // The following string array will allow the use of 
        // the name "customListenerAttribute" in the configuration
 file.
        return new string[]
 { "customListenerAttribute" };
    }
}
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照



英和和英テキスト翻訳

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

辞書ショートカット

すべての辞書の索引

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

   

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



TraceListener.GetSupportedAttributes メソッドのページの著作権

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

©2026 GRAS Group, Inc.RSS