This documentation is archived and is not being maintained.

TraceListener.GetSupportedAttributes Method

Note: This method is new in the .NET Framework version 2.0.

Gets the custom attributes supported by the trace listener.

Namespace: System.Diagnostics
Assembly: System (in system.dll)

protected internal virtual string[] GetSupportedAttributes ()
protected String[] GetSupportedAttributes ()
protected internal function GetSupportedAttributes () : String[]

Return Value

A string array naming the custom attributes supported by the trace listener, or a null reference (Nothing in Visual Basic) if there are no custom attributes.

The default implementation for GetSupportedAttributes returns a null reference (Nothing in Visual Basic).

Notes to Inheritors When inheriting from the TraceListener class or a derived class, you can override the GetSupportedAttributes method to provide custom attributes for your class.

The following code sample shows an override of the GetSupportedAttributes method for a custom trace listener.

[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" };

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

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Framework

Supported in: 2.0