Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
2979 lines (2642 sloc) 195 KB
<Type Name="Trace" FullName="System.Diagnostics.Trace">
<TypeSignature Language="C#" Value="public sealed class Trace" />
<TypeSignature Language="ILAsm" Value=".class public auto ansi sealed beforefieldinit Trace extends System.Object" />
<TypeSignature Language="DocId" Value="T:System.Diagnostics.Trace" />
<TypeSignature Language="VB.NET" Value="Public NotInheritable Class Trace" />
<TypeSignature Language="C++ CLI" Value="public ref class Trace sealed" />
<TypeSignature Language="F#" Value="type Trace = class" />
<AssemblyInfo>
<AssemblyName>System.Diagnostics.TraceSource</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.1.1.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<Base>
<BaseTypeName>System.Object</BaseTypeName>
</Base>
<Interfaces />
<Docs>
<summary>Provides a set of methods and properties that help you trace the execution of your code. This class cannot be inherited.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
You can use the properties and methods in the <xref:System.Diagnostics.Trace> class to instrument release builds. Instrumentation allows you to monitor the health of your application running in real-life settings. Tracing helps you isolate problems and fix them without disturbing a running system.
This class provides methods to display an <xref:System.Diagnostics.Trace.Assert%2A> dialog box, and to emit an assertion that will always <xref:System.Diagnostics.Trace.Fail%2A>. This class provides write methods in the following variations: <xref:System.Diagnostics.Trace.Write%2A>, <xref:System.Diagnostics.Trace.WriteLine%2A>, <xref:System.Diagnostics.Trace.WriteIf%2A>, and <xref:System.Diagnostics.Trace.WriteLineIf%2A>.
The <xref:System.Diagnostics.BooleanSwitch> and <xref:System.Diagnostics.TraceSwitch> classes provide means to dynamically control the tracing output. You can modify the values of these switches without recompiling your application. For information on using the configuration file to set a switch, see the <xref:System.Diagnostics.Switch> class and the [How to: Create, Initialize and Configure Trace Switches](~/docs/framework/debug-trace-profile/how-to-create-initialize-and-configure-trace-switches.md) topic.
You can customize the tracing output's target by adding <xref:System.Diagnostics.TraceListener> instances to or removing instances from the <xref:System.Diagnostics.Trace.Listeners%2A> collection. The <xref:System.Diagnostics.Trace.Listeners%2A> collection is shared by both the <xref:System.Diagnostics.Debug> and the <xref:System.Diagnostics.Trace> classes; adding a trace listener to either class adds the listener to both. By default, trace output is emitted using the <xref:System.Diagnostics.DefaultTraceListener> class.
> [!NOTE]
> Adding a trace listener to the <xref:System.Diagnostics.Trace.Listeners%2A> collection can cause an exception to be thrown while tracing, if a resource used by the trace listener is not available. The conditions and the exception thrown depend on the trace listener and cannot be enumerated in this topic. It may be useful to place calls to the <xref:System.Diagnostics.Trace> methods in `try`/`catch` blocks to detect and handle any exceptions from trace listeners.
> [!NOTE]
> If you add trace listeners to partially trusted code, you will get a <xref:System.Security.SecurityException> exception, because adding trace listeners requires <xref:System.Security.Permissions.SecurityPermissionFlag.UnmanagedCode> permission. To trace partially trusted code that is running in a sandbox in Visual Studio, do not add trace listeners. Instead, view the <xref:System.Diagnostics.Trace> and <xref:System.Diagnostics.Debug> messages in the **Output** window.
The <xref:System.Diagnostics.Trace> class provides properties to get or set the level of <xref:System.Diagnostics.Trace.Indent%2A>, the <xref:System.Diagnostics.Trace.IndentSize%2A>, and whether to <xref:System.Diagnostics.Trace.AutoFlush%2A> after each write.
To set the <xref:System.Diagnostics.Trace.AutoFlush%2A> and <xref:System.Diagnostics.Trace.IndentSize%2A> for <xref:System.Diagnostics.Trace>, you can edit the configuration file that corresponds to the name of your application. The configuration file should be formatted like the following example:
```xml
<configuration>
<system.diagnostics>
<trace autoflush="false" indentsize="3" />
</system.diagnostics>
</configuration>
```
The <xref:System.Diagnostics.ConditionalAttribute> attribute is applied to the methods of <xref:System.Diagnostics.Trace>. Compilers that support <xref:System.Diagnostics.ConditionalAttribute> ignore calls to these methods unless "TRACE" is defined as a conditional compilation symbol. Refer to a compiler's documentation to determine whether <xref:System.Diagnostics.ConditionalAttribute> is supported and the syntax for defining a conditional compilation symbol.
> [!NOTE]
> In Visual Studio projects, by default, the "DEBUG" conditional compilation symbol is defined for debug builds, and the "TRACE" symbol is defined for both debug and release builds. For information about how to disable this behavior, see the Visual Studio documentation.
To define the "TRACE" conditional compilation symbol in C#, add the `/d:TRACE` option to the compiler command line when you compile your code using a command line, or add `#define TRACE` to the top of your file. In Visual Basic, add the `/d:TRACE=True` option to the compiler command line or add `#Const TRACE=True` to the file.
<xref:System.Diagnostics.ConditionalAttribute> is not supported by the C++ compiler. To provide equivalent functionality, you must enclose calls to the methods of <xref:System.Diagnostics.Trace> in an `#if defined(TRACE) ... #endif` block, and add the `/DTRACE` option to the compiler command line or add `#define TRACE` to the file.
## Examples
The following example uses <xref:System.Diagnostics.Trace> to indicate the beginning and the end of a program's execution. The example also uses the <xref:System.Diagnostics.Trace.Indent%2A?displayProperty=nameWithType> and <xref:System.Diagnostics.Trace.Unindent%2A?displayProperty=nameWithType> methods to distinguish the tracing output. For a more complete example of the use of <xref:System.Diagnostics.Trace>, see [How to: Add Trace Statements to Application Code](~/docs/framework/debug-trace-profile/how-to-add-trace-statements-to-application-code.md).
[!code-cpp[Classic Trace Example#1](~/samples/snippets/cpp/VS_Snippets_CLR_Classic/classic Trace Example/CPP/source.cpp#1)]
[!code-csharp[Classic Trace Example#1](~/samples/snippets/csharp/VS_Snippets_CLR_Classic/classic Trace Example/CS/source.cs#1)]
[!code-vb[Classic Trace Example#1](~/samples/snippets/visualbasic/VS_Snippets_CLR_Classic/classic Trace Example/VB/source.vb#1)]
]]></format>
</remarks>
<permission cref="T:System.Security.Permissions.SecurityPermission">for operating with unmanaged code. Security action: <see cref="F:System.Security.Permissions.SecurityAction.Demand" />. Associated enumeration: <see cref="F:System.Security.Permissions.SecurityPermissionFlag.UnmanagedCode" /></permission>
<threadsafe>This type is thread safe.</threadsafe>
<altmember cref="T:System.Diagnostics.Debug" />
<altmember cref="T:System.Diagnostics.Switch" />
<altmember cref="T:System.Diagnostics.BooleanSwitch" />
<altmember cref="T:System.Diagnostics.TraceSwitch" />
<altmember cref="T:System.Diagnostics.TraceListener" />
<altmember cref="T:System.Diagnostics.DefaultTraceListener" />
<altmember cref="T:System.Diagnostics.EventLogTraceListener" />
<altmember cref="T:System.Diagnostics.TraceListenerCollection" />
<altmember cref="T:System.Diagnostics.ConditionalAttribute" />
</Docs>
<Members>
<MemberGroup MemberName="Assert">
<AssemblyInfo>
<AssemblyName>System.Diagnostics.TraceSource</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
</AssemblyInfo>
<Docs>
<summary>Checks for a condition; if the condition is <see langword="false" />, outputs messages and displays a message box that shows the call stack.</summary>
</Docs>
</MemberGroup>
<Member MemberName="Assert">
<MemberSignature Language="C#" Value="public static void Assert (bool condition);" />
<MemberSignature Language="ILAsm" Value=".method public static hidebysig void Assert(bool condition) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Diagnostics.Trace.Assert(System.Boolean)" />
<MemberSignature Language="VB.NET" Value="Public Shared Sub Assert (condition As Boolean)" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; static void Assert(bool condition);" />
<MemberSignature Language="F#" Value="static member Assert : bool -&gt; unit" Usage="System.Diagnostics.Trace.Assert condition" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Diagnostics.TraceSource</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.1.1.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netcore-1.0;netcore-1.1;netcore-2.0;netcore-2.1;netframework-1.1;netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netstandard-2.0;xamarinandroid-7.1;xamarinios-10.8;xamarinmac-3.0;netframework-4.8;netcore-2.2;netcore-3.0;netstandard-2.1">
<AttributeName>System.Diagnostics.Conditional("TRACE")</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="condition" Type="System.Boolean" />
</Parameters>
<Docs>
<param name="condition">The conditional expression to evaluate. If the condition is <see langword="true" />, a failure message is not sent and the message box is not displayed.</param>
<summary>Checks for a condition; if the condition is <see langword="false" />, displays a message box that shows the call stack.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
Use the <xref:System.Diagnostics.Trace.Assert%2A?displayProperty=nameWithType> method if you want to do assertions in release builds. The <xref:System.Diagnostics.Debug.Assert%2A?displayProperty=nameWithType> method works only in debug builds. For more information, see [Assertions in Managed Code](/visualstudio/debugger/assertions-in-managed-code).
Typically, the <xref:System.Diagnostics.Trace.Assert%28System.Boolean%29> method is used to identify logic errors during program development. <xref:System.Diagnostics.Trace.Assert%28System.Boolean%29> evaluates the condition. If the result is `false`, it sends a failure message to the <xref:System.Diagnostics.Trace.Listeners%2A> collection. You can customize this behavior by adding a <xref:System.Diagnostics.TraceListener> to, or removing one from, the <xref:System.Diagnostics.Trace.Listeners%2A> collection.
When the application runs in user-interface mode, it displays a message box that shows the call stack with file and line numbers. The message box contains three buttons: **Abort**, **Retry**, and **Ignore**. Clicking the **Abort** button terminates the application. Clicking **Retry** sends you to the code in the debugger if your application is running in a debugger, or offers to open a debugger if it is not. Clicking **Ignore** continues with the next instruction in the code.
> [!NOTE]
> The display of the message box depends on the presence of the <xref:System.Diagnostics.DefaultTraceListener>. If the <xref:System.Diagnostics.DefaultTraceListener> is not in the <xref:System.Diagnostics.Trace.Listeners%2A> collection, the message box is not displayed. The <xref:System.Diagnostics.DefaultTraceListener> can be removed by the [&lt;clear&gt;](~/docs/framework/configure-apps/file-schema/trace-debug/clear-element-for-listeners-for-trace.md), the [&lt;remove&gt;](~/docs/framework/configure-apps/file-schema/trace-debug/remove-element-for-listeners-for-trace.md), or by calling the <xref:System.Diagnostics.TraceListenerCollection.Clear%2A> method on the <xref:System.Diagnostics.Trace.Listeners%2A> property (`System.Diagnostics.Trace.Listeners.Clear()`).
You can change the behavior of the <xref:System.Diagnostics.DefaultTraceListener> in the configuration file that corresponds to the name of your application. In this file, you can enable and disable the assert message box or set the <xref:System.Diagnostics.DefaultTraceListener.LogFileName%2A?displayProperty=nameWithType> property. The configuration file should be formatted as follows:
```xml
<configuration>
<system.diagnostics>
<switches>
<add name="mySwitch" value="4"/>
</switches>
<trace autoflush="false" indentsize="4"/>
<assert assertuienabled="true" logfilename=".\TraceLog.txt"/>
</system.diagnostics>
</configuration>
```
## Examples
The following example creates an index for an array. Then some action is performed that sets the value of the index. Next the code calls <xref:System.Diagnostics.Trace.Assert%2A> to verify the index value is valid. If it is not valid, the <xref:System.Diagnostics.Trace.Assert%2A> outputs the call stack.
[!code-cpp[Classic Trace.Assert Example#1](~/samples/snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.Assert Example/CPP/source.cpp#1)]
[!code-csharp[Classic Trace.Assert Example#1](~/samples/snippets/csharp/VS_Snippets_CLR_Classic/classic Trace.Assert Example/CS/source.cs#1)]
[!code-vb[Classic Trace.Assert Example#1](~/samples/snippets/visualbasic/VS_Snippets_CLR_Classic/classic Trace.Assert Example/VB/source.vb#1)]
]]></format>
</remarks>
<altmember cref="T:System.Diagnostics.Debug" />
<altmember cref="T:System.Diagnostics.Trace" />
<altmember cref="T:System.Diagnostics.BooleanSwitch" />
<altmember cref="T:System.Diagnostics.TraceSwitch" />
<altmember cref="T:System.Diagnostics.TraceListener" />
<altmember cref="T:System.Diagnostics.DefaultTraceListener" />
<altmember cref="T:System.Diagnostics.ConditionalAttribute" />
</Docs>
</Member>
<Member MemberName="Assert">
<MemberSignature Language="C#" Value="public static void Assert (bool condition, string message);" />
<MemberSignature Language="ILAsm" Value=".method public static hidebysig void Assert(bool condition, string message) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Diagnostics.Trace.Assert(System.Boolean,System.String)" />
<MemberSignature Language="VB.NET" Value="Public Shared Sub Assert (condition As Boolean, message As String)" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; static void Assert(bool condition, System::String ^ message);" />
<MemberSignature Language="F#" Value="static member Assert : bool * string -&gt; unit" Usage="System.Diagnostics.Trace.Assert (condition, message)" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Diagnostics.TraceSource</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.1.1.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netcore-1.0;netcore-1.1;netcore-2.0;netcore-2.1;netframework-1.1;netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netstandard-2.0;xamarinandroid-7.1;xamarinios-10.8;xamarinmac-3.0;netframework-4.8;netcore-2.2;netcore-3.0;netstandard-2.1">
<AttributeName>System.Diagnostics.Conditional("TRACE")</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="condition" Type="System.Boolean" />
<Parameter Name="message" Type="System.String" />
</Parameters>
<Docs>
<param name="condition">The conditional expression to evaluate. If the condition is <see langword="true" />, the specified message is not sent and the message box is not displayed.</param>
<param name="message">The message to send to the <see cref="P:System.Diagnostics.Trace.Listeners" /> collection.</param>
<summary>Checks for a condition; if the condition is <see langword="false" />, outputs a specified message and displays a message box that shows the call stack.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
Use the <xref:System.Diagnostics.Trace.Assert%2A?displayProperty=nameWithType> method if you want to do assertions in release builds. The <xref:System.Diagnostics.Debug.Assert%2A?displayProperty=nameWithType> method works only in debug builds. For more information, see [Assertions in Managed Code](/visualstudio/debugger/assertions-in-managed-code).
Typically, the <xref:System.Diagnostics.Trace.Assert%28System.Boolean%2CSystem.String%29> method is used to identify logic errors during program development. <xref:System.Diagnostics.Trace.Assert%28System.Boolean%2CSystem.String%29> evaluates the condition. If the result is `false`, it sends the specified diagnostic message to the <xref:System.Diagnostics.Trace.Listeners%2A> collection. You can customize this behavior by adding a <xref:System.Diagnostics.TraceListener> to, or removing one from, the <xref:System.Diagnostics.Trace.Listeners%2A> collection.
When the application runs in user-interface mode, it displays a message box that shows the call stack with file and line numbers. The message box contains three buttons: **Abort**, **Retry**, and **Ignore**. Clicking the **Abort** button terminates the application. Clicking **Retry** sends you to the code in the debugger if your application is running in a debugger, or offers to open a debugger if it is not. Clicking **Ignore** continues with the next instruction in the code.
> [!NOTE]
> The display of the message box depends on the presence of the <xref:System.Diagnostics.DefaultTraceListener>. If the <xref:System.Diagnostics.DefaultTraceListener> is not in the <xref:System.Diagnostics.Trace.Listeners%2A> collection, the message box is not displayed. The <xref:System.Diagnostics.DefaultTraceListener> can be removed by the [&lt;clear&gt;](~/docs/framework/configure-apps/file-schema/trace-debug/clear-element-for-listeners-for-trace.md), the [&lt;remove&gt;](~/docs/framework/configure-apps/file-schema/trace-debug/remove-element-for-listeners-for-trace.md), or by calling the <xref:System.Diagnostics.TraceListenerCollection.Clear%2A> method on the <xref:System.Diagnostics.Trace.Listeners%2A> property (`System.Diagnostics.Trace.Listeners.Clear()`).
You can change the behavior of the <xref:System.Diagnostics.DefaultTraceListener> in the configuration file that corresponds to the name of your application. In this file, you can enable and disable the assert message box or set the <xref:System.Diagnostics.DefaultTraceListener.LogFileName%2A?displayProperty=nameWithType> property. The configuration file should be formatted as follows:
```xml
<configuration>
<system.diagnostics>
<switches>
<add name="mySwitch" value="4"/>
</switches>
<trace autoflush="false" indentsize="4"/>
<assert assertuienabled="true" logfilename=".\TraceLog.txt"/>
</system.diagnostics>
</configuration>
```
## Examples
The following example checks to see that the `type` parameter is valid. If the `type` passed in is `null`, the <xref:System.Diagnostics.Trace.Assert%2A> outputs a message.
[!code-cpp[Classic Trace.Assert1 Example#1](~/samples/snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.Assert1 Example/CPP/source.cpp#1)]
[!code-csharp[Classic Trace.Assert1 Example#1](~/samples/snippets/csharp/VS_Snippets_CLR_Classic/classic Trace.Assert1 Example/CS/source.cs#1)]
[!code-vb[Classic Trace.Assert1 Example#1](~/samples/snippets/visualbasic/VS_Snippets_CLR_Classic/classic Trace.Assert1 Example/VB/source.vb#1)]
]]></format>
</remarks>
<altmember cref="T:System.Diagnostics.Debug" />
<altmember cref="T:System.Diagnostics.Trace" />
<altmember cref="T:System.Diagnostics.BooleanSwitch" />
<altmember cref="T:System.Diagnostics.TraceSwitch" />
<altmember cref="T:System.Diagnostics.TraceListener" />
<altmember cref="T:System.Diagnostics.DefaultTraceListener" />
<altmember cref="T:System.Diagnostics.ConditionalAttribute" />
</Docs>
</Member>
<Member MemberName="Assert">
<MemberSignature Language="C#" Value="public static void Assert (bool condition, string message, string detailMessage);" />
<MemberSignature Language="ILAsm" Value=".method public static hidebysig void Assert(bool condition, string message, string detailMessage) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Diagnostics.Trace.Assert(System.Boolean,System.String,System.String)" />
<MemberSignature Language="VB.NET" Value="Public Shared Sub Assert (condition As Boolean, message As String, detailMessage As String)" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; static void Assert(bool condition, System::String ^ message, System::String ^ detailMessage);" />
<MemberSignature Language="F#" Value="static member Assert : bool * string * string -&gt; unit" Usage="System.Diagnostics.Trace.Assert (condition, message, detailMessage)" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Diagnostics.TraceSource</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.1.1.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netcore-1.0;netcore-1.1;netcore-2.0;netcore-2.1;netframework-1.1;netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netstandard-2.0;xamarinandroid-7.1;xamarinios-10.8;xamarinmac-3.0;netframework-4.8;netcore-2.2;netcore-3.0;netstandard-2.1">
<AttributeName>System.Diagnostics.Conditional("TRACE")</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="condition" Type="System.Boolean" />
<Parameter Name="message" Type="System.String" />
<Parameter Name="detailMessage" Type="System.String" />
</Parameters>
<Docs>
<param name="condition">The conditional expression to evaluate. If the condition is <see langword="true" />, the specified messages are not sent and the message box is not displayed.</param>
<param name="message">The message to send to the <see cref="P:System.Diagnostics.Trace.Listeners" /> collection.</param>
<param name="detailMessage">The detailed message to send to the <see cref="P:System.Diagnostics.Trace.Listeners" /> collection.</param>
<summary>Checks for a condition; if the condition is <see langword="false" />, outputs two specified messages and displays a message box that shows the call stack.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
Use the <xref:System.Diagnostics.Trace.Assert%2A?displayProperty=nameWithType> method if you want to do assertions in release builds. The <xref:System.Diagnostics.Debug.Assert%2A?displayProperty=nameWithType> method works only in debug builds. For more information, see [Assertions in Managed Code](/visualstudio/debugger/assertions-in-managed-code).
Typically, the <xref:System.Diagnostics.Trace.Assert%28System.Boolean%2CSystem.String%2CSystem.String%29> method is used to identify logic errors during program development. <xref:System.Diagnostics.Trace.Assert%2A> evaluates the condition. If the result is `false`, it sends the specified diagnostic message and detailed message to the <xref:System.Diagnostics.Trace.Listeners%2A> collection. You can customize this behavior by adding a <xref:System.Diagnostics.TraceListener> to, or removing one from, the <xref:System.Diagnostics.Trace.Listeners%2A> collection.
When the application runs in user-interface mode, it displays a message box that shows the call stack with file and line numbers. The message box contains three buttons: **Abort**, **Retry**, and **Ignore**. Clicking the **Abort** button terminates the application. Clicking **Retry** sends you to the code in the debugger if your application is running in a debugger, or offers to open a debugger if it is not. Clicking **Ignore** continues with the next instruction in the code.
> [!NOTE]
> The display of the message box depends on the presence of the <xref:System.Diagnostics.DefaultTraceListener>. If the <xref:System.Diagnostics.DefaultTraceListener> is not in the <xref:System.Diagnostics.Trace.Listeners%2A> collection, the message box is not displayed. The <xref:System.Diagnostics.DefaultTraceListener> can be removed by the [&lt;clear&gt;](~/docs/framework/configure-apps/file-schema/trace-debug/clear-element-for-listeners-for-trace.md), the [&lt;remove&gt;](~/docs/framework/configure-apps/file-schema/trace-debug/remove-element-for-listeners-for-trace.md), or by calling the <xref:System.Diagnostics.TraceListenerCollection.Clear%2A> method on the <xref:System.Diagnostics.Trace.Listeners%2A> property (`System.Diagnostics.Trace.Listeners.Clear()`).
You can change the behavior of the <xref:System.Diagnostics.DefaultTraceListener> in the configuration file that corresponds to the name of your application. In this file, you can enable and disable the assert message box or set the <xref:System.Diagnostics.DefaultTraceListener.LogFileName%2A?displayProperty=nameWithType> property. The configuration file should be formatted as follows:
```xml
<configuration>
<system.diagnostics>
<switches>
<add name="mySwitch" value="4"/>
</switches>
<trace autoflush="false" indentsize="4"/>
<assert assertuienabled="true" logfilename=".\TraceLog.txt"/>
</system.diagnostics>
</configuration>
```
## Examples
The following example checks to see that the `type` parameter is valid. If the `type` passed in is `null`, the <xref:System.Diagnostics.Trace.Assert%2A> outputs a message.
[!code-cpp[Classic Trace.Assert2 Example#1](~/samples/snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.Assert2 Example/CPP/source.cpp#1)]
[!code-csharp[Classic Trace.Assert2 Example#1](~/samples/snippets/csharp/VS_Snippets_CLR_Classic/classic Trace.Assert2 Example/CS/source.cs#1)]
[!code-vb[Classic Trace.Assert2 Example#1](~/samples/snippets/visualbasic/VS_Snippets_CLR_Classic/classic Trace.Assert2 Example/VB/source.vb#1)]
]]></format>
</remarks>
<altmember cref="T:System.Diagnostics.Debug" />
<altmember cref="T:System.Diagnostics.Trace" />
<altmember cref="T:System.Diagnostics.BooleanSwitch" />
<altmember cref="T:System.Diagnostics.TraceSwitch" />
<altmember cref="T:System.Diagnostics.TraceListener" />
<altmember cref="T:System.Diagnostics.DefaultTraceListener" />
<altmember cref="T:System.Diagnostics.ConditionalAttribute" />
</Docs>
</Member>
<Member MemberName="AutoFlush">
<MemberSignature Language="C#" Value="public static bool AutoFlush { get; set; }" />
<MemberSignature Language="ILAsm" Value=".property bool AutoFlush" />
<MemberSignature Language="DocId" Value="P:System.Diagnostics.Trace.AutoFlush" />
<MemberSignature Language="VB.NET" Value="Public Shared Property AutoFlush As Boolean" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; static property bool AutoFlush { bool get(); void set(bool value); };" />
<MemberSignature Language="F#" Value="member this.AutoFlush : bool with get, set" Usage="System.Diagnostics.Trace.AutoFlush" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.Diagnostics.TraceSource</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.1.1.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Boolean</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets or sets whether <see cref="M:System.Diagnostics.Trace.Flush" /> should be called on the <see cref="P:System.Diagnostics.Trace.Listeners" /> after every write.</summary>
<value>
<see langword="true" /> if <see cref="M:System.Diagnostics.Trace.Flush" /> is called on the <see cref="P:System.Diagnostics.Trace.Listeners" /> after every write; otherwise, <see langword="false" />.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The default is `false`.
Flushing the stream will not flush its underlying encoder unless you explicitly call <xref:System.Diagnostics.Trace.Flush%2A> or <xref:System.Diagnostics.Trace.Close%2A>. Setting <xref:System.Diagnostics.Trace.AutoFlush%2A> to `true` means that data will be flushed from the buffer to the stream, but the encoder state will not be flushed. This allows the encoder to keep its state (partial characters) so that it can encode the next block of characters correctly. This scenario affects UTF8 and UTF7 where certain characters can only be encoded after the encoder receives the adjacent character or characters.
To set the <xref:System.Diagnostics.Trace.AutoFlush%2A> and <xref:System.Diagnostics.Trace.IndentSize%2A> for <xref:System.Diagnostics.Trace>, you can also edit the configuration file that corresponds to the name of your application. The configuration file should be formatted like the following example:
```xml
<configuration>
<system.diagnostics>
<trace autoflush="false" indentsize="3" />
</system.diagnostics>
</configuration>
```
]]></format>
</remarks>
<permission cref="T:System.Security.Permissions.SecurityPermission">for operating with unmanaged code. Security action: <see cref="F:System.Security.Permissions.SecurityAction.LinkDemand" />. Associated enumeration: <see cref="F:System.Security.Permissions.SecurityPermissionFlag.UnmanagedCode" /></permission>
<altmember cref="T:System.Diagnostics.Debug" />
<altmember cref="T:System.Diagnostics.Trace" />
<altmember cref="T:System.Diagnostics.BooleanSwitch" />
<altmember cref="T:System.Diagnostics.TraceSwitch" />
<altmember cref="T:System.Diagnostics.TraceListener" />
<altmember cref="T:System.Diagnostics.DefaultTraceListener" />
<altmember cref="T:System.Diagnostics.ConditionalAttribute" />
</Docs>
</Member>
<Member MemberName="Close">
<MemberSignature Language="C#" Value="public static void Close ();" />
<MemberSignature Language="ILAsm" Value=".method public static hidebysig void Close() cil managed" />
<MemberSignature Language="DocId" Value="M:System.Diagnostics.Trace.Close" />
<MemberSignature Language="VB.NET" Value="Public Shared Sub Close ()" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; static void Close();" />
<MemberSignature Language="F#" Value="static member Close : unit -&gt; unit" Usage="System.Diagnostics.Trace.Close " />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Diagnostics.TraceSource</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.1.1.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netcore-1.0;netcore-1.1;netcore-2.0;netcore-2.1;netframework-1.1;netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netstandard-2.0;xamarinandroid-7.1;xamarinios-10.8;xamarinmac-3.0;netframework-4.8;netcore-2.2;netcore-3.0;netstandard-2.1">
<AttributeName>System.Diagnostics.Conditional("TRACE")</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters />
<Docs>
<summary>Flushes the output buffer, and then closes the <see cref="P:System.Diagnostics.Trace.Listeners" />.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
Use this method when the output is going to a file, such as to the <xref:System.Diagnostics.TextWriterTraceListener>.
Flushing the stream will not flush its underlying encoder unless you explicitly call <xref:System.Diagnostics.Trace.Flush%2A> or <xref:System.Diagnostics.Trace.Close%2A>. Setting <xref:System.Diagnostics.Trace.AutoFlush%2A> to `true` means that data will be flushed from the buffer to the stream, but the encoder state will not be flushed. This allows the encoder to keep its state (partial characters) so that it can encode the next block of characters correctly. This scenario affects UTF8 and UTF7 where certain characters can only be encoded after the encoder receives the adjacent character or characters.
## Examples
The following example creates a <xref:System.Diagnostics.TextWriterTraceListener> named `myTextListener`. `myTextListener` uses a <xref:System.IO.StreamWriter> called `myOutputWriter` to write to a file named `TestFile.txt`. The example creates the file, stream and text writer, writes one line of text to the file, and then flushes and closes the output.
[!code-cpp[Classic Trace.Flush Example#1](~/samples/snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.Flush Example/CPP/source.cpp#1)]
[!code-csharp[Classic Trace.Flush Example#1](~/samples/snippets/csharp/VS_Snippets_CLR_Classic/classic Trace.Flush Example/CS/source.cs#1)]
[!code-vb[Classic Trace.Flush Example#1](~/samples/snippets/visualbasic/VS_Snippets_CLR_Classic/classic Trace.Flush Example/VB/source.vb#1)]
]]></format>
</remarks>
<permission cref="T:System.Security.Permissions.SecurityPermission">for operating with unmanaged code. Security action: <see cref="F:System.Security.Permissions.SecurityAction.Demand" />. Associated enumeration: <see cref="F:System.Security.Permissions.SecurityPermissionFlag.UnmanagedCode" /></permission>
<altmember cref="T:System.Diagnostics.Debug" />
<altmember cref="T:System.Diagnostics.Trace" />
<altmember cref="T:System.Diagnostics.BooleanSwitch" />
<altmember cref="T:System.Diagnostics.TraceSwitch" />
<altmember cref="T:System.Diagnostics.TraceListener" />
<altmember cref="T:System.Diagnostics.DefaultTraceListener" />
<altmember cref="T:System.Diagnostics.ConditionalAttribute" />
</Docs>
</Member>
<Member MemberName="CorrelationManager">
<MemberSignature Language="C#" Value="public static System.Diagnostics.CorrelationManager CorrelationManager { get; }" />
<MemberSignature Language="ILAsm" Value=".property class System.Diagnostics.CorrelationManager CorrelationManager" />
<MemberSignature Language="DocId" Value="P:System.Diagnostics.Trace.CorrelationManager" />
<MemberSignature Language="VB.NET" Value="Public Shared ReadOnly Property CorrelationManager As CorrelationManager" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; static property System::Diagnostics::CorrelationManager ^ CorrelationManager { System::Diagnostics::CorrelationManager ^ get(); };" />
<MemberSignature Language="F#" Value="member this.CorrelationManager : System.Diagnostics.CorrelationManager" Usage="System.Diagnostics.Trace.CorrelationManager" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.Diagnostics.TraceSource</AssemblyName>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.1.1.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Diagnostics.CorrelationManager</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets the correlation manager for the thread for this trace.</summary>
<value>The <see cref="T:System.Diagnostics.CorrelationManager" /> object associated with the thread for this trace.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
> [!NOTE]
> This is an advanced property that most applications should not have occasion to use.
The <xref:System.Diagnostics.CorrelationManager> class provides methods used to store a logical operation identity in a thread-bound context and automatically tag each trace event generated by the thread with the stored identity.
]]></format>
</remarks>
<permission cref="T:System.Security.Permissions.SecurityPermission">for operating with unmanaged code. Security action: <see cref="F:System.Security.Permissions.SecurityAction.LinkDemand" />. Associated enumeration: <see cref="F:System.Security.Permissions.SecurityPermissionFlag.UnmanagedCode" /></permission>
<altmember cref="T:System.Diagnostics.CorrelationManager" />
</Docs>
</Member>
<MemberGroup MemberName="Fail">
<AssemblyInfo>
<AssemblyName>System.Diagnostics.TraceSource</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
</AssemblyInfo>
<Docs>
<summary>Emits an error message.</summary>
</Docs>
</MemberGroup>
<Member MemberName="Fail">
<MemberSignature Language="C#" Value="public static void Fail (string message);" />
<MemberSignature Language="ILAsm" Value=".method public static hidebysig void Fail(string message) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Diagnostics.Trace.Fail(System.String)" />
<MemberSignature Language="VB.NET" Value="Public Shared Sub Fail (message As String)" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; static void Fail(System::String ^ message);" />
<MemberSignature Language="F#" Value="static member Fail : string -&gt; unit" Usage="System.Diagnostics.Trace.Fail message" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Diagnostics.TraceSource</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.1.1.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netcore-1.0;netcore-1.1;netcore-2.0;netcore-2.1;netframework-1.1;netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netstandard-2.0;xamarinandroid-7.1;xamarinios-10.8;xamarinmac-3.0;netframework-4.8;netcore-2.2;netcore-3.0;netstandard-2.1">
<AttributeName>System.Diagnostics.Conditional("TRACE")</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="message" Type="System.String" />
</Parameters>
<Docs>
<param name="message">A message to emit.</param>
<summary>Emits the specified error message.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The default behavior for the default trace listener is to output the `message` parameter to a message box when the application runs in user-interface mode, and to the <xref:System.Diagnostics.TraceListener> instances in the <xref:System.Diagnostics.Trace.Listeners%2A> collection.
> [!NOTE]
> The display of the message box is dependent on the presence of the <xref:System.Diagnostics.DefaultTraceListener>. If the <xref:System.Diagnostics.DefaultTraceListener> is not in the <xref:System.Diagnostics.Trace.Listeners%2A> collection, the message box is not displayed. The <xref:System.Diagnostics.DefaultTraceListener> can be removed by the [&lt;clear&gt;](~/docs/framework/configure-apps/file-schema/trace-debug/clear-element-for-listeners-for-trace.md), the [&lt;remove&gt;](~/docs/framework/configure-apps/file-schema/trace-debug/remove-element-for-listeners-for-trace.md), or by calling the <xref:System.Diagnostics.TraceListenerCollection.Clear%2A> method on the <xref:System.Diagnostics.Trace.Listeners%2A> property (`System.Diagnostics.Trace.Listeners.Clear()`).
You can customize this behavior by adding a <xref:System.Diagnostics.TraceListener> to, or by removing one from, the <xref:System.Diagnostics.Trace.Listeners%2A> collection.
## Examples
The following example uses the <xref:System.Diagnostics.Trace.Fail%2A> method to print a message during exception handling.
[!code-cpp[Classic Trace.Fail Example#1](~/samples/snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.Fail Example/CPP/source.cpp#1)]
[!code-csharp[Classic Trace.Fail Example#1](~/samples/snippets/csharp/VS_Snippets_CLR_Classic/classic Trace.Fail Example/CS/source.cs#1)]
[!code-vb[Classic Trace.Fail Example#1](~/samples/snippets/visualbasic/VS_Snippets_CLR_Classic/classic Trace.Fail Example/VB/source.vb#1)]
You can also use the <xref:System.Diagnostics.Trace.Fail%2A> method in a switch statement.
[!code-cpp[Classic Trace.Fail Example#2](~/samples/snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.Fail Example/CPP/source.cpp#2)]
[!code-csharp[Classic Trace.Fail Example#2](~/samples/snippets/csharp/VS_Snippets_CLR_Classic/classic Trace.Fail Example/CS/source.cs#2)]
[!code-vb[Classic Trace.Fail Example#2](~/samples/snippets/visualbasic/VS_Snippets_CLR_Classic/classic Trace.Fail Example/VB/source.vb#2)]
]]></format>
</remarks>
<altmember cref="T:System.Diagnostics.Debug" />
<altmember cref="T:System.Diagnostics.Trace" />
<altmember cref="T:System.Diagnostics.BooleanSwitch" />
<altmember cref="T:System.Diagnostics.TraceSwitch" />
<altmember cref="T:System.Diagnostics.TraceListener" />
<altmember cref="T:System.Diagnostics.DefaultTraceListener" />
<altmember cref="T:System.Diagnostics.ConditionalAttribute" />
</Docs>
</Member>
<Member MemberName="Fail">
<MemberSignature Language="C#" Value="public static void Fail (string message, string detailMessage);" />
<MemberSignature Language="ILAsm" Value=".method public static hidebysig void Fail(string message, string detailMessage) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Diagnostics.Trace.Fail(System.String,System.String)" />
<MemberSignature Language="VB.NET" Value="Public Shared Sub Fail (message As String, detailMessage As String)" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; static void Fail(System::String ^ message, System::String ^ detailMessage);" />
<MemberSignature Language="F#" Value="static member Fail : string * string -&gt; unit" Usage="System.Diagnostics.Trace.Fail (message, detailMessage)" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Diagnostics.TraceSource</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.1.1.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netcore-1.0;netcore-1.1;netcore-2.0;netcore-2.1;netframework-1.1;netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netstandard-2.0;xamarinandroid-7.1;xamarinios-10.8;xamarinmac-3.0;netframework-4.8;netcore-2.2;netcore-3.0;netstandard-2.1">
<AttributeName>System.Diagnostics.Conditional("TRACE")</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="message" Type="System.String" />
<Parameter Name="detailMessage" Type="System.String" />
</Parameters>
<Docs>
<param name="message">A message to emit.</param>
<param name="detailMessage">A detailed message to emit.</param>
<summary>Emits an error message, and a detailed error message.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The default behavior is for the default trace listener to output the `message` parameter and the `detailedMessage` parameter to a message box when the application runs in user-interface mode, and to the <xref:System.Diagnostics.TraceListener> instances in the <xref:System.Diagnostics.Trace.Listeners%2A> collection.
> [!NOTE]
> The display of the message box is dependent on the presence of the <xref:System.Diagnostics.DefaultTraceListener>. If the <xref:System.Diagnostics.DefaultTraceListener> is not in the <xref:System.Diagnostics.Trace.Listeners%2A> collection, the message box is not displayed. The <xref:System.Diagnostics.DefaultTraceListener> can be removed by the [&lt;clear&gt;](~/docs/framework/configure-apps/file-schema/trace-debug/clear-element-for-listeners-for-trace.md), the [&lt;remove&gt;](~/docs/framework/configure-apps/file-schema/trace-debug/remove-element-for-listeners-for-trace.md), or by calling the <xref:System.Diagnostics.TraceListenerCollection.Clear%2A> method on the <xref:System.Diagnostics.Trace.Listeners%2A> property (`System.Diagnostics.Trace.Listeners.Clear()`).
You can customize this behavior by adding a <xref:System.Diagnostics.TraceListener> to, or by removing one from, the <xref:System.Diagnostics.Trace.Listeners%2A> collection.
## Examples
The following example uses the <xref:System.Diagnostics.Trace.Fail%2A> method to print a message during exception handling.
[!code-cpp[Classic Trace.Fail1 Example#1](~/samples/snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.Fail1 Example/CPP/source.cpp#1)]
[!code-csharp[Classic Trace.Fail1 Example#1](~/samples/snippets/csharp/VS_Snippets_CLR_Classic/classic Trace.Fail1 Example/CS/source.cs#1)]
[!code-vb[Classic Trace.Fail1 Example#1](~/samples/snippets/visualbasic/VS_Snippets_CLR_Classic/classic Trace.Fail1 Example/VB/source.vb#1)]
You can also use the <xref:System.Diagnostics.Trace.Fail%2A> method in a switch statement.
[!code-cpp[Classic Trace.Fail1 Example#2](~/samples/snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.Fail1 Example/CPP/source.cpp#2)]
[!code-csharp[Classic Trace.Fail1 Example#2](~/samples/snippets/csharp/VS_Snippets_CLR_Classic/classic Trace.Fail1 Example/CS/source.cs#2)]
[!code-vb[Classic Trace.Fail1 Example#2](~/samples/snippets/visualbasic/VS_Snippets_CLR_Classic/classic Trace.Fail1 Example/VB/source.vb#2)]
]]></format>
</remarks>
<altmember cref="T:System.Diagnostics.Debug" />
<altmember cref="T:System.Diagnostics.Trace" />
<altmember cref="T:System.Diagnostics.BooleanSwitch" />
<altmember cref="T:System.Diagnostics.TraceSwitch" />
<altmember cref="T:System.Diagnostics.TraceListener" />
<altmember cref="T:System.Diagnostics.DefaultTraceListener" />
<altmember cref="T:System.Diagnostics.ConditionalAttribute" />
</Docs>
</Member>
<Member MemberName="Flush">
<MemberSignature Language="C#" Value="public static void Flush ();" />
<MemberSignature Language="ILAsm" Value=".method public static hidebysig void Flush() cil managed" />
<MemberSignature Language="DocId" Value="M:System.Diagnostics.Trace.Flush" />
<MemberSignature Language="VB.NET" Value="Public Shared Sub Flush ()" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; static void Flush();" />
<MemberSignature Language="F#" Value="static member Flush : unit -&gt; unit" Usage="System.Diagnostics.Trace.Flush " />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Diagnostics.TraceSource</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.1.1.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netcore-1.0;netcore-1.1;netcore-2.0;netcore-2.1;netframework-1.1;netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netstandard-2.0;xamarinandroid-7.1;xamarinios-10.8;xamarinmac-3.0;netframework-4.8;netcore-2.2;netcore-3.0;netstandard-2.1">
<AttributeName>System.Diagnostics.Conditional("TRACE")</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters />
<Docs>
<summary>Flushes the output buffer, and causes buffered data to be written to the <see cref="P:System.Diagnostics.Trace.Listeners" />.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
Flushing the stream will not flush its underlying encoder unless you explicitly call <xref:System.Diagnostics.Trace.Flush%2A> or <xref:System.Diagnostics.Trace.Close%2A>. Setting <xref:System.Diagnostics.Trace.AutoFlush%2A> to `true` means that data will be flushed from the buffer to the stream, but the encoder state will not be flushed. This allows the encoder to keep its state (partial characters) so that it can encode the next block of characters correctly. This scenario affects UTF8 and UTF7 where certain characters can only be encoded after the encoder receives the adjacent character or characters.
## Examples
The following example creates a <xref:System.Diagnostics.TextWriterTraceListener> named `myTextListener`. `myTextListener` uses a <xref:System.IO.StreamWriter> called `myOutputWriter` to write to a file named `TestFile.txt`. The example creates the file, stream and text writer, writes one line of text to the file, and then flushes and closes the output.
[!code-cpp[Classic Trace.Flush Example#1](~/samples/snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.Flush Example/CPP/source.cpp#1)]
[!code-csharp[Classic Trace.Flush Example#1](~/samples/snippets/csharp/VS_Snippets_CLR_Classic/classic Trace.Flush Example/CS/source.cs#1)]
[!code-vb[Classic Trace.Flush Example#1](~/samples/snippets/visualbasic/VS_Snippets_CLR_Classic/classic Trace.Flush Example/VB/source.vb#1)]
]]></format>
</remarks>
<altmember cref="T:System.Diagnostics.Debug" />
<altmember cref="T:System.Diagnostics.Trace" />
<altmember cref="T:System.Diagnostics.BooleanSwitch" />
<altmember cref="T:System.Diagnostics.TraceSwitch" />
<altmember cref="T:System.Diagnostics.TraceListener" />
<altmember cref="T:System.Diagnostics.DefaultTraceListener" />
<altmember cref="T:System.Diagnostics.ConditionalAttribute" />
</Docs>
</Member>
<Member MemberName="Indent">
<MemberSignature Language="C#" Value="public static void Indent ();" />
<MemberSignature Language="ILAsm" Value=".method public static hidebysig void Indent() cil managed" />
<MemberSignature Language="DocId" Value="M:System.Diagnostics.Trace.Indent" />
<MemberSignature Language="VB.NET" Value="Public Shared Sub Indent ()" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; static void Indent();" />
<MemberSignature Language="F#" Value="static member Indent : unit -&gt; unit" Usage="System.Diagnostics.Trace.Indent " />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Diagnostics.TraceSource</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.1.1.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netcore-1.0;netcore-1.1;netcore-2.0;netcore-2.1;netframework-1.1;netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netstandard-2.0;xamarinandroid-7.1;xamarinios-10.8;xamarinmac-3.0;netframework-4.8;netcore-2.2;netcore-3.0;netstandard-2.1">
<AttributeName>System.Diagnostics.Conditional("TRACE")</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters />
<Docs>
<summary>Increases the current <see cref="P:System.Diagnostics.Trace.IndentLevel" /> by one.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Examples
The following example increments and decrements the indent level and emits tracing messages.
[!code-cpp[Classic Trace.IndentLevel Example#1](~/samples/snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.IndentLevel Example/CPP/source.cpp#1)]
[!code-csharp[Classic Trace.IndentLevel Example#1](~/samples/snippets/csharp/VS_Snippets_CLR_Classic/classic Trace.IndentLevel Example/CS/source.cs#1)]
[!code-vb[Classic Trace.IndentLevel Example#1](~/samples/snippets/visualbasic/VS_Snippets_CLR_Classic/classic Trace.IndentLevel Example/VB/source.vb#1)]
This example produces the following output:
```
List of errors:
Error 1: File not found
Error 2: Directory not found
End of list of errors
```
]]></format>
</remarks>
<altmember cref="M:System.Diagnostics.Trace.Unindent" />
<altmember cref="P:System.Diagnostics.Trace.IndentLevel" />
<altmember cref="P:System.Diagnostics.Trace.IndentSize" />
</Docs>
</Member>
<Member MemberName="IndentLevel">
<MemberSignature Language="C#" Value="public static int IndentLevel { get; set; }" />
<MemberSignature Language="ILAsm" Value=".property int32 IndentLevel" />
<MemberSignature Language="DocId" Value="P:System.Diagnostics.Trace.IndentLevel" />
<MemberSignature Language="VB.NET" Value="Public Shared Property IndentLevel As Integer" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; static property int IndentLevel { int get(); void set(int value); };" />
<MemberSignature Language="F#" Value="member this.IndentLevel : int with get, set" Usage="System.Diagnostics.Trace.IndentLevel" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.Diagnostics.TraceSource</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.1.1.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Int32</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets or sets the indent level.</summary>
<value>The indent level. The default is zero.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The <xref:System.Diagnostics.Trace.IndentLevel%2A> property represents the number of times the indent of size <xref:System.Diagnostics.Trace.IndentSize%2A> is applied. This property is stored on per-thread/per-request basis.
## Examples
The following example increments and decrements the indent level and emits tracing messages.
[!code-cpp[Classic Trace.IndentLevel Example#1](~/samples/snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.IndentLevel Example/CPP/source.cpp#1)]
[!code-csharp[Classic Trace.IndentLevel Example#1](~/samples/snippets/csharp/VS_Snippets_CLR_Classic/classic Trace.IndentLevel Example/CS/source.cs#1)]
[!code-vb[Classic Trace.IndentLevel Example#1](~/samples/snippets/visualbasic/VS_Snippets_CLR_Classic/classic Trace.IndentLevel Example/VB/source.vb#1)]
This example produces the following output:
```
List of errors:
Error 1: File not found
Error 2: Directory not found
End of list of errors
```
]]></format>
</remarks>
<altmember cref="P:System.Diagnostics.Trace.IndentSize" />
<altmember cref="T:System.Diagnostics.Debug" />
<altmember cref="T:System.Diagnostics.Trace" />
<altmember cref="T:System.Diagnostics.BooleanSwitch" />
<altmember cref="T:System.Diagnostics.TraceSwitch" />
<altmember cref="T:System.Diagnostics.TraceListener" />
<altmember cref="T:System.Diagnostics.DefaultTraceListener" />
<altmember cref="T:System.Diagnostics.ConditionalAttribute" />
</Docs>
</Member>
<Member MemberName="IndentSize">
<MemberSignature Language="C#" Value="public static int IndentSize { get; set; }" />
<MemberSignature Language="ILAsm" Value=".property int32 IndentSize" />
<MemberSignature Language="DocId" Value="P:System.Diagnostics.Trace.IndentSize" />
<MemberSignature Language="VB.NET" Value="Public Shared Property IndentSize As Integer" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; static property int IndentSize { int get(); void set(int value); };" />
<MemberSignature Language="F#" Value="member this.IndentSize : int with get, set" Usage="System.Diagnostics.Trace.IndentSize" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.Diagnostics.TraceSource</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.1.1.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Int32</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets or sets the number of spaces in an indent.</summary>
<value>The number of spaces in an indent. The default is four.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
A <xref:System.Diagnostics.TextWriterTraceListener> interprets this number as spaces. An <xref:System.Diagnostics.EventLogTraceListener> ignores this value.
This property is stored on per-thread/per-request basis.
To set the <xref:System.Diagnostics.Trace.AutoFlush%2A> and <xref:System.Diagnostics.Trace.IndentSize%2A> for <xref:System.Diagnostics.Trace>, you can also edit the configuration file that corresponds to the name of your application. The configuration file should be formatted like the following example:
```xml
<configuration>
<system.diagnostics>
<trace autoflush="false" indentsize="3" />
</system.diagnostics>
</configuration>
```
]]></format>
</remarks>
<altmember cref="P:System.Diagnostics.Trace.IndentLevel" />
<altmember cref="T:System.Diagnostics.Debug" />
<altmember cref="T:System.Diagnostics.Trace" />
<altmember cref="T:System.Diagnostics.BooleanSwitch" />
<altmember cref="T:System.Diagnostics.TraceSwitch" />
<altmember cref="T:System.Diagnostics.TraceListener" />
<altmember cref="T:System.Diagnostics.DefaultTraceListener" />
<altmember cref="T:System.Diagnostics.ConditionalAttribute" />
</Docs>
</Member>
<Member MemberName="Listeners">
<MemberSignature Language="C#" Value="public static System.Diagnostics.TraceListenerCollection Listeners { get; }" />
<MemberSignature Language="ILAsm" Value=".property class System.Diagnostics.TraceListenerCollection Listeners" />
<MemberSignature Language="DocId" Value="P:System.Diagnostics.Trace.Listeners" />
<MemberSignature Language="VB.NET" Value="Public Shared ReadOnly Property Listeners As TraceListenerCollection" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; static property System::Diagnostics::TraceListenerCollection ^ Listeners { System::Diagnostics::TraceListenerCollection ^ get(); };" />
<MemberSignature Language="F#" Value="member this.Listeners : System.Diagnostics.TraceListenerCollection" Usage="System.Diagnostics.Trace.Listeners" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.Diagnostics.TraceSource</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.1.1.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Diagnostics.TraceListenerCollection</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets the collection of listeners that is monitoring the trace output.</summary>
<value>A <see cref="T:System.Diagnostics.TraceListenerCollection" /> that represents a collection of type <see cref="T:System.Diagnostics.TraceListener" /> monitoring the trace output.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The listeners produce formatted output from the trace output. By default, the collection contains an instance of the <xref:System.Diagnostics.DefaultTraceListener> class. If you want to remove the default listener, call the <xref:System.Diagnostics.TraceListenerCollection.Remove%2A> method, and pass it the instance of the <xref:System.Diagnostics.DefaultTraceListener>. To redirect output to the console window, add an instance of the <xref:System.Diagnostics.ConsoleTraceListener> class.
> [!NOTE]
> The <xref:System.Diagnostics.Trace.Listeners%2A> collection is shared by both the <xref:System.Diagnostics.Debug> and the <xref:System.Diagnostics.Trace> classes; adding a trace listener to either class adds the listener to both.
## Examples
The following example creates a <xref:System.Diagnostics.ConsoleTraceListener> that outputs to the console screen. The code then adds the new listener to the <xref:System.Diagnostics.Trace.Listeners%2A>.
[!code-cpp[Classic Trace.Listeners Example#1](~/samples/snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.Listeners Example/CPP/source.cpp#1)]
[!code-csharp[Classic Trace.Listeners Example#1](~/samples/snippets/csharp/VS_Snippets_CLR_Classic/classic Trace.Listeners Example/CS/source.cs#1)]
[!code-vb[Classic Trace.Listeners Example#1](~/samples/snippets/visualbasic/VS_Snippets_CLR_Classic/classic Trace.Listeners Example/VB/source.vb#1)]
]]></format>
</remarks>
<permission cref="T:System.Security.Permissions.SecurityPermission">for operating with unmanaged code. Security action: <see cref="F:System.Security.Permissions.SecurityAction.Demand" />. Associated enumeration: <see cref="F:System.Security.Permissions.SecurityPermissionFlag.UnmanagedCode" /></permission>
<altmember cref="T:System.Diagnostics.Debug" />
<altmember cref="T:System.Diagnostics.Trace" />
<altmember cref="T:System.Diagnostics.BooleanSwitch" />
<altmember cref="T:System.Diagnostics.TraceSwitch" />
<altmember cref="T:System.Diagnostics.TraceListener" />
<altmember cref="T:System.Diagnostics.DefaultTraceListener" />
<altmember cref="T:System.Diagnostics.ConditionalAttribute" />
</Docs>
</Member>
<Member MemberName="Refresh">
<MemberSignature Language="C#" Value="public static void Refresh ();" />
<MemberSignature Language="ILAsm" Value=".method public static hidebysig void Refresh() cil managed" />
<MemberSignature Language="DocId" Value="M:System.Diagnostics.Trace.Refresh" />
<MemberSignature Language="VB.NET" Value="Public Shared Sub Refresh ()" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; static void Refresh();" />
<MemberSignature Language="F#" Value="static member Refresh : unit -&gt; unit" Usage="System.Diagnostics.Trace.Refresh " />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Diagnostics.TraceSource</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.1.1.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters />
<Docs>
<summary>Refreshes the trace configuration data.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
Trace configuration data is captured when the application is started. If the configuration data is changed after the application is started, call the <xref:System.Diagnostics.Trace.Refresh%2A> method to update the trace configuration data.
]]></format>
</remarks>
</Docs>
</Member>
<MemberGroup MemberName="TraceError">
<AssemblyInfo>
<AssemblyName>System.Diagnostics.TraceSource</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
</AssemblyInfo>
<Docs>
<summary>Writes error information to the trace listeners in the <see cref="P:System.Diagnostics.Trace.Listeners" /> collection.</summary>
</Docs>
</MemberGroup>
<Member MemberName="TraceError">
<MemberSignature Language="C#" Value="public static void TraceError (string message);" />
<MemberSignature Language="ILAsm" Value=".method public static hidebysig void TraceError(string message) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Diagnostics.Trace.TraceError(System.String)" />
<MemberSignature Language="VB.NET" Value="Public Shared Sub TraceError (message As String)" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; static void TraceError(System::String ^ message);" />
<MemberSignature Language="F#" Value="static member TraceError : string -&gt; unit" Usage="System.Diagnostics.Trace.TraceError message" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Diagnostics.TraceSource</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.1.1.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netcore-1.0;netcore-1.1;netcore-2.0;netcore-2.1;netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netstandard-2.0;xamarinandroid-7.1;xamarinios-10.8;xamarinmac-3.0;netframework-4.8;netcore-2.2;netcore-3.0;netstandard-2.1">
<AttributeName>System.Diagnostics.Conditional("TRACE")</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="message" Type="System.String" Index="0" FrameworkAlternate="netcore-1.0;netcore-1.1;netcore-2.0;netcore-2.1;netcore-2.2;netcore-3.0;netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;netstandard-2.0;netstandard-2.1;xamarinandroid-7.1;xamarinios-10.8;xamarinmac-3.0" />
</Parameters>
<Docs>
<param name="message">The informative message to write.</param>
<summary>Writes an error message to the trace listeners in the <see cref="P:System.Diagnostics.Trace.Listeners" /> collection using the specified message.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
<xref:System.Diagnostics.Trace.TraceError%2A> calls the `TraceEvent` method for each trace listener, with the trace event type <xref:System.Diagnostics.TraceEventType.Error>, passing the informative message as the message string.
]]></format>
</remarks>
<altmember cref="T:System.Diagnostics.Debug" />
<altmember cref="T:System.Diagnostics.Trace" />
<altmember cref="T:System.Diagnostics.BooleanSwitch" />
<altmember cref="T:System.Diagnostics.TraceSwitch" />
<altmember cref="T:System.Diagnostics.TraceListener" />
<altmember cref="T:System.Diagnostics.DefaultTraceListener" />
<altmember cref="T:System.Diagnostics.ConditionalAttribute" />
</Docs>
</Member>
<Member MemberName="TraceError">
<MemberSignature Language="C#" Value="public static void TraceError (string format, params object[] args);" />
<MemberSignature Language="ILAsm" Value=".method public static hidebysig void TraceError(string format, object[] args) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Diagnostics.Trace.TraceError(System.String,System.Object[])" />
<MemberSignature Language="VB.NET" Value="Public Shared Sub TraceError (format As String, ParamArray args As Object())" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; static void TraceError(System::String ^ format, ... cli::array &lt;System::Object ^&gt; ^ args);" />
<MemberSignature Language="F#" Value="static member TraceError : string * obj[] -&gt; unit" Usage="System.Diagnostics.Trace.TraceError (format, args)" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Diagnostics.TraceSource</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.1.1.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netcore-1.0;netcore-1.1;netcore-2.0;netcore-2.1;netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netstandard-2.0;xamarinandroid-7.1;xamarinios-10.8;xamarinmac-3.0;netframework-4.8;netcore-2.2;netcore-3.0;netstandard-2.1">
<AttributeName>System.Diagnostics.Conditional("TRACE")</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="format" Type="System.String" Index="0" FrameworkAlternate="netcore-1.0;netcore-1.1;netcore-2.0;netcore-2.1;netcore-2.2;netcore-3.0;netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;netstandard-2.0;netstandard-2.1;xamarinandroid-7.1;xamarinios-10.8;xamarinmac-3.0" />
<Parameter Name="args" Type="System.Object[]" Index="1" FrameworkAlternate="netcore-1.0;netcore-1.1;netcore-2.0;netcore-2.1;netcore-2.2;netcore-3.0;netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;netstandard-2.0;netstandard-2.1;xamarinandroid-7.1;xamarinios-10.8;xamarinmac-3.0">
<Attributes>
<Attribute FrameworkAlternate="netcore-1.0">
<AttributeName>System.ParamArray</AttributeName>
</Attribute>
</Attributes>
</Parameter>
</Parameters>
<Docs>
<param name="format">A format string that contains zero or more format items, which correspond to objects in the <paramref name="args" /> array.</param>
<param name="args">An <see langword="object" /> array containing zero or more objects to format.</param>
<summary>Writes an error message to the trace listeners in the <see cref="P:System.Diagnostics.Trace.Listeners" /> collection using the specified array of objects and formatting information.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
<xref:System.Diagnostics.Trace.TraceError%2A> calls the `TraceEvent` methods in the trace listeners with the trace event type <xref:System.Diagnostics.TraceEventType.Error>, passing the message content as an object array with formatting information. See the <xref:System.String.Format%2A> method for more information about the `format` and `args` parameters.
]]></format>
</remarks>
<altmember cref="T:System.Diagnostics.Debug" />
<altmember cref="T:System.Diagnostics.Trace" />
<altmember cref="T:System.Diagnostics.BooleanSwitch" />
<altmember cref="T:System.Diagnostics.TraceSwitch" />
<altmember cref="T:System.Diagnostics.TraceListener" />
<altmember cref="T:System.Diagnostics.DefaultTraceListener" />
<altmember cref="T:System.Diagnostics.ConditionalAttribute" />
</Docs>
</Member>
<MemberGroup MemberName="TraceInformation">
<AssemblyInfo>
<AssemblyName>System.Diagnostics.TraceSource</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
</AssemblyInfo>
<Docs>
<summary>Writes an informational message to the trace listeners in the <see cref="P:System.Diagnostics.Trace.Listeners" /> collection.</summary>
</Docs>
</MemberGroup>
<Member MemberName="TraceInformation">
<MemberSignature Language="C#" Value="public static void TraceInformation (string message);" />
<MemberSignature Language="ILAsm" Value=".method public static hidebysig void TraceInformation(string message) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Diagnostics.Trace.TraceInformation(System.String)" />
<MemberSignature Language="VB.NET" Value="Public Shared Sub TraceInformation (message As String)" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; static void TraceInformation(System::String ^ message);" />
<MemberSignature Language="F#" Value="static member TraceInformation : string -&gt; unit" Usage="System.Diagnostics.Trace.TraceInformation message" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Diagnostics.TraceSource</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.1.1.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netcore-1.0;netcore-1.1;netcore-2.0;netcore-2.1;netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netstandard-2.0;xamarinandroid-7.1;xamarinios-10.8;xamarinmac-3.0;netframework-4.8;netcore-2.2;netcore-3.0;netstandard-2.1">
<AttributeName>System.Diagnostics.Conditional("TRACE")</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="message" Type="System.String" Index="0" FrameworkAlternate="netcore-1.0;netcore-1.1;netcore-2.0;netcore-2.1;netcore-2.2;netcore-3.0;netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;netstandard-2.0;netstandard-2.1;xamarinandroid-7.1;xamarinios-10.8;xamarinmac-3.0" />
</Parameters>
<Docs>
<param name="message">The informative message to write.</param>
<summary>Writes an informational message to the trace listeners in the <see cref="P:System.Diagnostics.Trace.Listeners" /> collection using the specified message.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
<xref:System.Diagnostics.Trace.TraceInformation%2A> calls the `TraceEvent` method for each trace listener, with the trace event type <xref:System.Diagnostics.TraceEventType.Information>, passing the informative message as the message string.
]]></format>
</remarks>
<altmember cref="T:System.Diagnostics.Debug" />
<altmember cref="T:System.Diagnostics.Trace" />
<altmember cref="T:System.Diagnostics.BooleanSwitch" />
<altmember cref="T:System.Diagnostics.TraceSwitch" />
<altmember cref="T:System.Diagnostics.TraceListener" />
<altmember cref="T:System.Diagnostics.DefaultTraceListener" />
<altmember cref="T:System.Diagnostics.ConditionalAttribute" />
</Docs>
</Member>
<Member MemberName="TraceInformation">
<MemberSignature Language="C#" Value="public static void TraceInformation (string format, params object[] args);" />
<MemberSignature Language="ILAsm" Value=".method public static hidebysig void TraceInformation(string format, object[] args) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Diagnostics.Trace.TraceInformation(System.String,System.Object[])" />
<MemberSignature Language="VB.NET" Value="Public Shared Sub TraceInformation (format As String, ParamArray args As Object())" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; static void TraceInformation(System::String ^ format, ... cli::array &lt;System::Object ^&gt; ^ args);" />
<MemberSignature Language="F#" Value="static member TraceInformation : string * obj[] -&gt; unit" Usage="System.Diagnostics.Trace.TraceInformation (format, args)" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Diagnostics.TraceSource</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.1.1.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netcore-1.0;netcore-1.1;netcore-2.0;netcore-2.1;netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netstandard-2.0;xamarinandroid-7.1;xamarinios-10.8;xamarinmac-3.0;netframework-4.8;netcore-2.2;netcore-3.0;netstandard-2.1">
<AttributeName>System.Diagnostics.Conditional("TRACE")</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="format" Type="System.String" Index="0" FrameworkAlternate="netcore-1.0;netcore-1.1;netcore-2.0;netcore-2.1;netcore-2.2;netcore-3.0;netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;netstandard-2.0;netstandard-2.1;xamarinandroid-7.1;xamarinios-10.8;xamarinmac-3.0" />
<Parameter Name="args" Type="System.Object[]" Index="1" FrameworkAlternate="netcore-1.0;netcore-1.1;netcore-2.0;netcore-2.1;netcore-2.2;netcore-3.0;netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;netstandard-2.0;netstandard-2.1;xamarinandroid-7.1;xamarinios-10.8;xamarinmac-3.0">
<Attributes>
<Attribute FrameworkAlternate="netcore-1.0">
<AttributeName>System.ParamArray</AttributeName>
</Attribute>
</Attributes>
</Parameter>
</Parameters>
<Docs>
<param name="format">A format string that contains zero or more format items, which correspond to objects in the <paramref name="args" /> array.</param>
<param name="args">An <see langword="object" /> array containing zero or more objects to format.</param>
<summary>Writes an informational message to the trace listeners in the <see cref="P:System.Diagnostics.Trace.Listeners" /> collection using the specified array of objects and formatting information.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
<xref:System.Diagnostics.Trace.TraceInformation%2A> calls the `TraceEvent` methods in the trace listeners with the trace event type <xref:System.Diagnostics.TraceEventType.Information>, passing the message content as an object array with formatting information. See the <xref:System.String.Format%2A> method for more information about the `format` and `args` parameters.
]]></format>
</remarks>
<altmember cref="T:System.Diagnostics.Debug" />
<altmember cref="T:System.Diagnostics.Trace" />
<altmember cref="T:System.Diagnostics.BooleanSwitch" />
<altmember cref="T:System.Diagnostics.TraceSwitch" />
<altmember cref="T:System.Diagnostics.TraceListener" />
<altmember cref="T:System.Diagnostics.DefaultTraceListener" />
<altmember cref="T:System.Diagnostics.ConditionalAttribute" />
</Docs>
</Member>
<MemberGroup MemberName="TraceWarning">
<AssemblyInfo>
<AssemblyName>System.Diagnostics.TraceSource</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
</AssemblyInfo>
<Docs>
<summary>Writes warning information to the trace listeners in the <see cref="P:System.Diagnostics.Trace.Listeners" /> collection.</summary>
</Docs>
</MemberGroup>
<Member MemberName="TraceWarning">
<MemberSignature Language="C#" Value="public static void TraceWarning (string message);" />
<MemberSignature Language="ILAsm" Value=".method public static hidebysig void TraceWarning(string message) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Diagnostics.Trace.TraceWarning(System.String)" />
<MemberSignature Language="VB.NET" Value="Public Shared Sub TraceWarning (message As String)" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; static void TraceWarning(System::String ^ message);" />
<MemberSignature Language="F#" Value="static member TraceWarning : string -&gt; unit" Usage="System.Diagnostics.Trace.TraceWarning message" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Diagnostics.TraceSource</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.1.1.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netcore-1.0;netcore-1.1;netcore-2.0;netcore-2.1;netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netstandard-2.0;xamarinandroid-7.1;xamarinios-10.8;xamarinmac-3.0;netframework-4.8;netcore-2.2;netcore-3.0;netstandard-2.1">
<AttributeName>System.Diagnostics.Conditional("TRACE")</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="message" Type="System.String" Index="0" FrameworkAlternate="netcore-1.0;netcore-1.1;netcore-2.0;netcore-2.1;netcore-2.2;netcore-3.0;netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;netstandard-2.0;netstandard-2.1;xamarinandroid-7.1;xamarinios-10.8;xamarinmac-3.0" />
</Parameters>
<Docs>
<param name="message">The informative message to write.</param>
<summary>Writes a warning message to the trace listeners in the <see cref="P:System.Diagnostics.Trace.Listeners" /> collection using the specified message.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
<xref:System.Diagnostics.Trace.TraceWarning%2A> calls the `TraceEvent` method for each trace listener with the trace event type <xref:System.Diagnostics.TraceEventType.Warning>, passing the informative message as the message string.
]]></format>
</remarks>
<altmember cref="T:System.Diagnostics.Debug" />
<altmember cref="T:System.Diagnostics.Trace" />
<altmember cref="T:System.Diagnostics.BooleanSwitch" />
<altmember cref="T:System.Diagnostics.TraceSwitch" />
<altmember cref="T:System.Diagnostics.TraceListener" />
<altmember cref="T:System.Diagnostics.DefaultTraceListener" />
<altmember cref="T:System.Diagnostics.ConditionalAttribute" />
</Docs>
</Member>
<Member MemberName="TraceWarning">
<MemberSignature Language="C#" Value="public static void TraceWarning (string format, params object[] args);" />
<MemberSignature Language="ILAsm" Value=".method public static hidebysig void TraceWarning(string format, object[] args) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Diagnostics.Trace.TraceWarning(System.String,System.Object[])" />
<MemberSignature Language="VB.NET" Value="Public Shared Sub TraceWarning (format As String, ParamArray args As Object())" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; static void TraceWarning(System::String ^ format, ... cli::array &lt;System::Object ^&gt; ^ args);" />
<MemberSignature Language="F#" Value="static member TraceWarning : string * obj[] -&gt; unit" Usage="System.Diagnostics.Trace.TraceWarning (format, args)" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Diagnostics.TraceSource</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.1.1.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netcore-1.0;netcore-1.1;netcore-2.0;netcore-2.1;netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netstandard-2.0;xamarinandroid-7.1;xamarinios-10.8;xamarinmac-3.0;netframework-4.8;netcore-2.2;netcore-3.0;netstandard-2.1">
<AttributeName>System.Diagnostics.Conditional("TRACE")</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="format" Type="System.String" Index="0" FrameworkAlternate="netcore-1.0;netcore-1.1;netcore-2.0;netcore-2.1;netcore-2.2;netcore-3.0;netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;netstandard-2.0;netstandard-2.1;xamarinandroid-7.1;xamarinios-10.8;xamarinmac-3.0" />
<Parameter Name="args" Type="System.Object[]" Index="1" FrameworkAlternate="netcore-1.0;netcore-1.1;netcore-2.0;netcore-2.1;netcore-2.2;netcore-3.0;netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;netstandard-2.0;netstandard-2.1;xamarinandroid-7.1;xamarinios-10.8;xamarinmac-3.0">
<Attributes>
<Attribute FrameworkAlternate="netcore-1.0">
<AttributeName>System.ParamArray</AttributeName>
</Attribute>
</Attributes>
</Parameter>
</Parameters>
<Docs>
<param name="format">A format string that contains zero or more format items, which correspond to objects in the <paramref name="args" /> array.</param>
<param name="args">An <see langword="object" /> array containing zero or more objects to format.</param>
<summary>Writes a warning message to the trace listeners in the <see cref="P:System.Diagnostics.Trace.Listeners" /> collection using the specified array of objects and formatting information.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
<xref:System.Diagnostics.Trace.TraceWarning%2A> calls the `TraceEvent` methods in the trace listeners with the trace event type <xref:System.Diagnostics.TraceEventType.Warning>, passing the message content as an object array with formatting information. See the <xref:System.String.Format%2A> method for more information about the `format` and `args` parameters.
]]></format>
</remarks>
<altmember cref="T:System.Diagnostics.Debug" />
<altmember cref="T:System.Diagnostics.Trace" />
<altmember cref="T:System.Diagnostics.BooleanSwitch" />
<altmember cref="T:System.Diagnostics.TraceSwitch" />
<altmember cref="T:System.Diagnostics.TraceListener" />
<altmember cref="T:System.Diagnostics.DefaultTraceListener" />
<altmember cref="T:System.Diagnostics.ConditionalAttribute" />
</Docs>
</Member>
<Member MemberName="Unindent">
<MemberSignature Language="C#" Value="public static void Unindent ();" />
<MemberSignature Language="ILAsm" Value=".method public static hidebysig void Unindent() cil managed" />
<MemberSignature Language="DocId" Value="M:System.Diagnostics.Trace.Unindent" />
<MemberSignature Language="VB.NET" Value="Public Shared Sub Unindent ()" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; static void Unindent();" />
<MemberSignature Language="F#" Value="static member Unindent : unit -&gt; unit" Usage="System.Diagnostics.Trace.Unindent " />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Diagnostics.TraceSource</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.1.1.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netcore-1.0;netcore-1.1;netcore-2.0;netcore-2.1;netframework-1.1;netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netstandard-2.0;xamarinandroid-7.1;xamarinios-10.8;xamarinmac-3.0;netframework-4.8;netcore-2.2;netcore-3.0;netstandard-2.1">
<AttributeName>System.Diagnostics.Conditional("TRACE")</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters />
<Docs>
<summary>Decreases the current <see cref="P:System.Diagnostics.Trace.IndentLevel" /> by one.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Examples
The following example increments and decrements the indent level and emits tracing messages.
[!code-cpp[Classic Trace.IndentLevel Example#1](~/samples/snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.IndentLevel Example/CPP/source.cpp#1)]
[!code-csharp[Classic Trace.IndentLevel Example#1](~/samples/snippets/csharp/VS_Snippets_CLR_Classic/classic Trace.IndentLevel Example/CS/source.cs#1)]
[!code-vb[Classic Trace.IndentLevel Example#1](~/samples/snippets/visualbasic/VS_Snippets_CLR_Classic/classic Trace.IndentLevel Example/VB/source.vb#1)]
This example produces the following output:
```
List of errors:
Error 1: File not found
Error 2: Directory not found
End of list of errors
```
]]></format>
</remarks>
<altmember cref="M:System.Diagnostics.Trace.Indent" />
<altmember cref="P:System.Diagnostics.Trace.IndentLevel" />
<altmember cref="P:System.Diagnostics.Trace.IndentSize" />
</Docs>
</Member>
<Member MemberName="UseGlobalLock">
<MemberSignature Language="C#" Value="public static bool UseGlobalLock { get; set; }" />
<MemberSignature Language="ILAsm" Value=".property bool UseGlobalLock" />
<MemberSignature Language="DocId" Value="P:System.Diagnostics.Trace.UseGlobalLock" />
<MemberSignature Language="VB.NET" Value="Public Shared Property UseGlobalLock As Boolean" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; static property bool UseGlobalLock { bool get(); void set(bool value); };" />
<MemberSignature Language="F#" Value="member this.UseGlobalLock : bool with get, set" Usage="System.Diagnostics.Trace.UseGlobalLock" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.Diagnostics.TraceSource</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.1.1.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Boolean</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets or sets a value indicating whether the global lock should be used.</summary>
<value>
<see langword="true" /> if the global lock is to be used; otherwise, <see langword="false" />. The default is <see langword="true" />.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The global lock is always used if the trace listener is not thread safe, regardless of the value of <xref:System.Diagnostics.Trace.UseGlobalLock%2A>. The <xref:System.Diagnostics.TraceListener.IsThreadSafe%2A> property is used to determine if the listener is thread safe. The global lock is not used only if the value of <xref:System.Diagnostics.Trace.UseGlobalLock%2A> is `false` and the value of <xref:System.Diagnostics.TraceListener.IsThreadSafe%2A> is `true`. The default behavior is to use the global lock.
To set the <xref:System.Diagnostics.Trace.UseGlobalLock%2A> for <xref:System.Diagnostics.Trace>, you can also edit the configuration file that corresponds to the name of your application. The configuration file should be formatted like the following example:
```xml
<configuration>
<system.diagnostics>
<trace useGlobalLock="false" />
</system.diagnostics>
</configuration>
```
]]></format>
</remarks>
<permission cref="T:System.Security.Permissions.SecurityPermission">for operating with unmanaged code. Security action: <see cref="F:System.Security.Permissions.SecurityAction.LinkDemand" />. Associated enumeration: <see cref="F:System.Security.Permissions.SecurityPermissionFlag.UnmanagedCode" /></permission>
</Docs>
</Member>
<MemberGroup MemberName="Write">
<AssemblyInfo>
<AssemblyName>System.Diagnostics.TraceSource</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
</AssemblyInfo>
<Docs>
<summary>Writes information about the trace to the trace listeners in the <see cref="P:System.Diagnostics.Trace.Listeners" /> collection.</summary>
</Docs>
</MemberGroup>
<Member MemberName="Write">
<MemberSignature Language="C#" Value="public static void Write (object value);" />
<MemberSignature Language="ILAsm" Value=".method public static hidebysig void Write(object value) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Diagnostics.Trace.Write(System.Object)" />
<MemberSignature Language="VB.NET" Value="Public Shared Sub Write (value As Object)" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; static void Write(System::Object ^ value);" />
<MemberSignature Language="F#" Value="static member Write : obj -&gt; unit" Usage="System.Diagnostics.Trace.Write value" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Diagnostics.TraceSource</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.1.1.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netcore-1.0;netcore-1.1;netcore-2.0;netcore-2.1;netframework-1.1;netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netstandard-2.0;xamarinandroid-7.1;xamarinios-10.8;xamarinmac-3.0;netframework-4.8;netcore-2.2;netcore-3.0;netstandard-2.1">
<AttributeName>System.Diagnostics.Conditional("TRACE")</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="value" Type="System.Object" />
</Parameters>
<Docs>
<param name="value">An <see cref="T:System.Object" /> whose name is sent to the <see cref="P:System.Diagnostics.Trace.Listeners" />.</param>
<summary>Writes the value of the object's <see cref="M:System.Object.ToString" /> method to the trace listeners in the <see cref="P:System.Diagnostics.Trace.Listeners" /> collection.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
By default, the output is written to an instance of <xref:System.Diagnostics.DefaultTraceListener>.
This method calls the <xref:System.Diagnostics.TraceListener.Write%2A> method of the trace listener.
> [!NOTE]
> ASP.NET supplies tracing functionality tailored for Web pages. To write trace messages in ASP.NET pages, use the <xref:System.Web.UI.Page.Trace%2A?displayProperty=nameWithType> property.
By default, in code associated with an ASP.NET Web page, the statement `Trace.Write("...")` is a call to the <xref:System.Web.TraceContext.Write%2A> method of the <xref:System.Web.UI.Page.Trace%2A?displayProperty=nameWithType> property. To use the <xref:System.Diagnostics.Trace?displayProperty=nameWithType> class in Web pages, you must include the namespace, for example, `System.Diagnostics.Trace.Write("...")`.
## Examples
The following example creates a <xref:System.Diagnostics.TraceSwitch> named `generalSwitch`. This switch is set outside the code sample.
If the switch is set to the <xref:System.Diagnostics.TraceLevel>`Error` or higher, the example outputs the first name of the `value` parameter to the <xref:System.Diagnostics.Trace.Listeners%2A>. For information on adding a listener to the <xref:System.Diagnostics.Trace.Listeners%2A> collection, see the <xref:System.Diagnostics.TraceListenerCollection> class.
Then, if the <xref:System.Diagnostics.TraceLevel> is set to `Verbose`, the example outputs a message on the same line as the first message. The second message is followed by a line terminator.
[!code-cpp[Classic Trace.Write1 Example#1](~/samples/snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.Write1 Example/CPP/source.cpp#1)]
[!code-csharp[Classic Trace.Write1 Example#1](~/samples/snippets/csharp/VS_Snippets_CLR_Classic/classic Trace.Write1 Example/CS/source.cs#1)]
[!code-vb[Classic Trace.Write1 Example#1](~/samples/snippets/visualbasic/VS_Snippets_CLR_Classic/classic Trace.Write1 Example/VB/source.vb#1)]
]]></format>
</remarks>
<altmember cref="T:System.Diagnostics.Debug" />
<altmember cref="T:System.Diagnostics.Trace" />
<altmember cref="T:System.Diagnostics.BooleanSwitch" />
<altmember cref="T:System.Diagnostics.TraceSwitch" />
<altmember cref="T:System.Diagnostics.TraceListener" />
<altmember cref="T:System.Diagnostics.DefaultTraceListener" />
<altmember cref="T:System.Diagnostics.ConditionalAttribute" />
</Docs>
</Member>
<Member MemberName="Write">
<MemberSignature Language="C#" Value="public static void Write (string message);" />
<MemberSignature Language="ILAsm" Value=".method public static hidebysig void Write(string message) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Diagnostics.Trace.Write(System.String)" />
<MemberSignature Language="VB.NET" Value="Public Shared Sub Write (message As String)" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; static void Write(System::String ^ message);" />
<MemberSignature Language="F#" Value="static member Write : string -&gt; unit" Usage="System.Diagnostics.Trace.Write message" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Diagnostics.TraceSource</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.1.1.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netcore-1.0;netcore-1.1;netcore-2.0;netcore-2.1;netframework-1.1;netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netstandard-2.0;xamarinandroid-7.1;xamarinios-10.8;xamarinmac-3.0;netframework-4.8;netcore-2.2;netcore-3.0;netstandard-2.1">
<AttributeName>System.Diagnostics.Conditional("TRACE")</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="message" Type="System.String" />
</Parameters>
<Docs>
<param name="message">A message to write.</param>
<summary>Writes a message to the trace listeners in the <see cref="P:System.Diagnostics.Trace.Listeners" /> collection.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
By default, the output is written to an instance of <xref:System.Diagnostics.DefaultTraceListener>.
This method calls the <xref:System.Diagnostics.TraceListener.Write%2A> method of the trace listener.
> [!NOTE]
> ASP.NET supplies tracing functionality tailored for Web pages. To write trace messages in ASP.NET pages, use the <xref:System.Web.UI.Page.Trace%2A?displayProperty=nameWithType> property.
By default, in code associated with an ASP.NET Web page, the statement `Trace.Write("...")` is a call to the <xref:System.Web.TraceContext.Write%2A> method of the <xref:System.Web.UI.Page.Trace%2A?displayProperty=nameWithType> property. To use the <xref:System.Diagnostics.Trace?displayProperty=nameWithType> class in Web pages, you must include the namespace, for example, `System.Diagnostics.Trace.Write("...")`.
## Examples
The following example creates a <xref:System.Diagnostics.TraceSwitch> named `generalSwitch`. This switch is set outside the code sample.
If the switch is set to the <xref:System.Diagnostics.TraceLevel>`Error` or higher, the example outputs the first error message to the <xref:System.Diagnostics.Trace.Listeners%2A>. For information on adding a listener to the <xref:System.Diagnostics.Trace.Listeners%2A> collection, see the <xref:System.Diagnostics.TraceListenerCollection> class.
Then, if the <xref:System.Diagnostics.TraceLevel> is set to `Verbose`, the example outputs the second error message on the same line as the first message. A line terminator follows the second message.
[!code-cpp[Classic Trace.Write Example#1](~/samples/snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.Write Example/CPP/source.cpp#1)]
[!code-csharp[Classic Trace.Write Example#1](~/samples/snippets/csharp/VS_Snippets_CLR_Classic/classic Trace.Write Example/CS/source.cs#1)]
[!code-vb[Classic Trace.Write Example#1](~/samples/snippets/visualbasic/VS_Snippets_CLR_Classic/classic Trace.Write Example/VB/source.vb#1)]
]]></format>
</remarks>
<altmember cref="T:System.Diagnostics.Debug" />
<altmember cref="T:System.Diagnostics.Trace" />
<altmember cref="T:System.Diagnostics.BooleanSwitch" />
<altmember cref="T:System.Diagnostics.TraceSwitch" />
<altmember cref="T:System.Diagnostics.TraceListener" />
<altmember cref="T:System.Diagnostics.DefaultTraceListener" />
<altmember cref="T:System.Diagnostics.ConditionalAttribute" />
</Docs>
</Member>
<Member MemberName="Write">
<MemberSignature Language="C#" Value="public static void Write (object value, string category);" />
<MemberSignature Language="ILAsm" Value=".method public static hidebysig void Write(object value, string category) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Diagnostics.Trace.Write(System.Object,System.String)" />
<MemberSignature Language="VB.NET" Value="Public Shared Sub Write (value As Object, category As String)" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; static void Write(System::Object ^ value, System::String ^ category);" />
<MemberSignature Language="F#" Value="static member Write : obj * string -&gt; unit" Usage="System.Diagnostics.Trace.Write (value, category)" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Diagnostics.TraceSource</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.1.1.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netcore-1.0;netcore-1.1;netcore-2.0;netcore-2.1;netframework-1.1;netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netstandard-2.0;xamarinandroid-7.1;xamarinios-10.8;xamarinmac-3.0;netframework-4.8;netcore-2.2;netcore-3.0;netstandard-2.1">
<AttributeName>System.Diagnostics.Conditional("TRACE")</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="value" Type="System.Object" />
<Parameter Name="category" Type="System.String" />
</Parameters>
<Docs>
<param name="value">An <see cref="T:System.Object" /> name is sent to the <see cref="P:System.Diagnostics.Trace.Listeners" />.</param>
<param name="category">A category name used to organize the output.</param>
<summary>Writes a category name and the value of the object's <see cref="M:System.Object.ToString" /> method to the trace listeners in the <see cref="P:System.Diagnostics.Trace.Listeners" /> collection.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
By default, the output is written to an instance of <xref:System.Diagnostics.DefaultTraceListener>.
The `category` parameter can be used to group output messages.
This method calls the <xref:System.Diagnostics.TraceListener.Write%2A> method of the trace listener.
> [!NOTE]
> ASP.NET supplies tracing functionality tailored for Web pages. To write trace messages in ASP.NET pages, use the <xref:System.Web.UI.Page.Trace%2A?displayProperty=nameWithType> property.
By default, in code associated with an ASP.NET Web page, the statement `Trace.Write("...")` is a call to the <xref:System.Web.TraceContext.Write%2A> method of the <xref:System.Web.UI.Page.Trace%2A?displayProperty=nameWithType> property. To use the <xref:System.Diagnostics.Trace?displayProperty=nameWithType> class in Web pages, you must include the namespace, for example, `System.Diagnostics.Trace.Write("...")`.
## Examples
The following example creates a <xref:System.Diagnostics.TraceSwitch> named `generalSwitch`. This switch is set outside the code sample.
If the switch is set to the <xref:System.Diagnostics.TraceLevel>`Verbose`, the example outputs the name of the `myObject` and the `category` to the <xref:System.Diagnostics.Trace.Listeners%2A>. For information on adding a listener to the <xref:System.Diagnostics.Trace.Listeners%2A> collection, see the <xref:System.Diagnostics.TraceListenerCollection> class.
Then, if the <xref:System.Diagnostics.TraceLevel> is set to `Error` or higher, the example outputs the second error message on the same line as the first message. The second message is followed by a line terminator.
[!code-cpp[Classic Trace.Write3 Example#1](~/samples/snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.Write3 Example/CPP/source.cpp#1)]
[!code-csharp[Classic Trace.Write3 Example#1](~/samples/snippets/csharp/VS_Snippets_CLR_Classic/classic Trace.Write3 Example/CS/source.cs#1)]
[!code-vb[Classic Trace.Write3 Example#1](~/samples/snippets/visualbasic/VS_Snippets_CLR_Classic/classic Trace.Write3 Example/VB/source.vb#1)]
]]></format>
</remarks>
<altmember cref="T:System.Diagnostics.Debug" />
<altmember cref="T:System.Diagnostics.Trace" />
<altmember cref="T:System.Diagnostics.BooleanSwitch" />
<altmember cref="T:System.Diagnostics.TraceSwitch" />
<altmember cref="T:System.Diagnostics.TraceListener" />
<altmember cref="T:System.Diagnostics.DefaultTraceListener" />
<altmember cref="T:System.Diagnostics.ConditionalAttribute" />
</Docs>
</Member>
<Member MemberName="Write">
<MemberSignature Language="C#" Value="public static void Write (string message, string category);" />
<MemberSignature Language="ILAsm" Value=".method public static hidebysig void Write(string message, string category) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Diagnostics.Trace.Write(System.String,System.String)" />
<MemberSignature Language="VB.NET" Value="Public Shared Sub Write (message As String, category As String)" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; static void Write(System::String ^ message, System::String ^ category);" />
<MemberSignature Language="F#" Value="static member Write : string * string -&gt; unit" Usage="System.Diagnostics.Trace.Write (message, category)" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Diagnostics.TraceSource</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.1.1.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netcore-1.0;netcore-1.1;netcore-2.0;netcore-2.1;netframework-1.1;netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netstandard-2.0;xamarinandroid-7.1;xamarinios-10.8;xamarinmac-3.0;netframework-4.8;netcore-2.2;netcore-3.0;netstandard-2.1">
<AttributeName>System.Diagnostics.Conditional("TRACE")</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="message" Type="System.String" />
<Parameter Name="category" Type="System.String" />
</Parameters>
<Docs>
<param name="message">A message to write.</param>
<param name="category">A category name used to organize the output.</param>
<summary>Writes a category name and a message to the trace listeners in the <see cref="P:System.Diagnostics.Trace.Listeners" /> collection.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
By default, the output is written to an instance of <xref:System.Diagnostics.DefaultTraceListener>.
The `category` parameter can be used to group output messages.
This method calls the <xref:System.Diagnostics.TraceListener.Write%2A> method of the trace listener.
> [!NOTE]
> ASP.NET supplies tracing functionality tailored for Web pages. To write trace messages in ASP.NET pages, use the <xref:System.Web.UI.Page.Trace%2A?displayProperty=nameWithType> property.
By default, in code associated with an ASP.NET Web page, the statement `Trace.Write("...")` is a call to the <xref:System.Web.TraceContext.Write%2A> method of the <xref:System.Web.UI.Page.Trace%2A?displayProperty=nameWithType> property. To use the <xref:System.Diagnostics.Trace?displayProperty=nameWithType> class in Web pages, you must include the namespace, for example, `System.Diagnostics.Trace.Write("...")`.
## Examples
The following example creates a <xref:System.Diagnostics.TraceSwitch> named `generalSwitch`. This switch is set outside the code sample.
If the switch is set to the <xref:System.Diagnostics.TraceLevel>`Verbose`, the example outputs the first error message to the <xref:System.Diagnostics.Trace.Listeners%2A>. For information on adding a listener to the <xref:System.Diagnostics.Trace.Listeners%2A> collection, see the <xref:System.Diagnostics.TraceListenerCollection> class.
Then, if the <xref:System.Diagnostics.TraceLevel> is set to `Error` or higher, the example outputs the second error message on the same line as the first message. The second message is followed by a line terminator.
[!code-cpp[Classic Trace.Write2 Example#1](~/samples/snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.Write2 Example/CPP/source.cpp#1)]
[!code-csharp[Classic Trace.Write2 Example#1](~/samples/snippets/csharp/VS_Snippets_CLR_Classic/classic Trace.Write2 Example/CS/source.cs#1)]
[!code-vb[Classic Trace.Write2 Example#1](~/samples/snippets/visualbasic/VS_Snippets_CLR_Classic/classic Trace.Write2 Example/VB/source.vb#1)]
]]></format>
</remarks>
<altmember cref="T:System.Diagnostics.Debug" />
<altmember cref="T:System.Diagnostics.Trace" />
<altmember cref="T:System.Diagnostics.BooleanSwitch" />
<altmember cref="T:System.Diagnostics.TraceSwitch" />
<altmember cref="T:System.Diagnostics.TraceListener" />
<altmember cref="T:System.Diagnostics.DefaultTraceListener" />
<altmember cref="T:System.Diagnostics.ConditionalAttribute" />
</Docs>
</Member>
<MemberGroup MemberName="WriteIf">
<AssemblyInfo>
<AssemblyName>System.Diagnostics.TraceSource</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
</AssemblyInfo>
<Docs>
<summary>Writes information about the trace to the trace listeners in the <see cref="P:System.Diagnostics.Trace.Listeners" /> collection if a condition is <see langword="true" />.</summary>
</Docs>
</MemberGroup>
<Member MemberName="WriteIf">
<MemberSignature Language="C#" Value="public static void WriteIf (bool condition, object value);" />
<MemberSignature Language="ILAsm" Value=".method public static hidebysig void WriteIf(bool condition, object value) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Diagnostics.Trace.WriteIf(System.Boolean,System.Object)" />
<MemberSignature Language="VB.NET" Value="Public Shared Sub WriteIf (condition As Boolean, value As Object)" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; static void WriteIf(bool condition, System::Object ^ value);" />
<MemberSignature Language="F#" Value="static member WriteIf : bool * obj -&gt; unit" Usage="System.Diagnostics.Trace.WriteIf (condition, value)" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Diagnostics.TraceSource</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.1.1.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netcore-1.0;netcore-1.1;netcore-2.0;netcore-2.1;netframework-1.1;netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netstandard-2.0;xamarinandroid-7.1;xamarinios-10.8;xamarinmac-3.0;netframework-4.8;netcore-2.2;netcore-3.0;netstandard-2.1">
<AttributeName>System.Diagnostics.Conditional("TRACE")</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="condition" Type="System.Boolean" />
<Parameter Name="value" Type="System.Object" />
</Parameters>
<Docs>
<param name="condition">
<see langword="true" /> to cause a message to be written; otherwise, <see langword="false" />.</param>
<param name="value">An <see cref="T:System.Object" /> whose name is sent to the <see cref="P:System.Diagnostics.Trace.Listeners" />.</param>
<summary>Writes the value of the object's <see cref="M:System.Object.ToString" /> method to the trace listeners in the <see cref="P:System.Diagnostics.Trace.Listeners" /> collection if a condition is <see langword="true" />.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
By default, the output is written to an instance of <xref:System.Diagnostics.DefaultTraceListener>.
This method calls the <xref:System.Diagnostics.TraceListener.Write%2A> method of the trace listener.
## Examples
The following example creates a <xref:System.Diagnostics.TraceSwitch> named `generalSwitch`. This switch is set outside the code sample.
If the switch is set to the <xref:System.Diagnostics.TraceLevel>`Error` or higher, the example outputs the first name of the value parameter to the <xref:System.Diagnostics.Trace.Listeners%2A>. For information on adding a listener to the <xref:System.Diagnostics.Trace.Listeners%2A> collection, see the <xref:System.Diagnostics.TraceListenerCollection> class.
Then, if the <xref:System.Diagnostics.TraceLevel> is set to `Verbose`, the example outputs a message on the same line as the first message. The second message is followed by a line terminator.
[!code-cpp[Classic Trace.WriteIf1 Example#1](~/samples/snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.WriteIf1 Example/CPP/source.cpp#1)]
[!code-csharp[Classic Trace.WriteIf1 Example#1](~/samples/snippets/csharp/VS_Snippets_CLR_Classic/classic Trace.WriteIf1 Example/CS/source.cs#1)]
[!code-vb[Classic Trace.WriteIf1 Example#1](~/samples/snippets/visualbasic/VS_Snippets_CLR_Classic/classic Trace.WriteIf1 Example/VB/source.vb#1)]
]]></format>
</remarks>
<block subset="none" type="overrides">
<para>You can minimize the performance penalty of instrumenting your application by using <see langword="If...Then" /> statements instead of using <see cref="M:System.Diagnostics.Trace.WriteIf(System.Boolean,System.String)" /> statements. The following two code examples send the same debugging message. However, the first example is much faster when tracing is off, because if <c>mySwitch.TraceError</c> evaluates to <see langword="false" /> you do not call <see cref="M:System.Diagnostics.Trace.Write(System.String)" />. The second example always calls <see cref="M:System.Diagnostics.Trace.WriteIf(System.Boolean,System.String)" />, even when <c>mySwitch.TraceError</c> is <see langword="false" /> and no tracing output is produced. This can result in unnecessary execution of arbitrarily complex code.
**First example**
```csharp
if(mySwitch.TraceError)
Trace.Write("aNumber = " + aNumber + " out of range");
```
**Second example**
```csharp
Trace.WriteIf(mySwitch.TraceError, "aNumber = " + aNumber + " out of range");
```</para>
</block>
<altmember cref="T:System.Diagnostics.Debug" />
<altmember cref="T:System.Diagnostics.Trace" />
<altmember cref="T:System.Diagnostics.BooleanSwitch" />
<altmember cref="T:System.Diagnostics.TraceSwitch" />
<altmember cref="T:System.Diagnostics.TraceListener" />
<altmember cref="T:System.Diagnostics.DefaultTraceListener" />
<altmember cref="T:System.Diagnostics.ConditionalAttribute" />
</Docs>
</Member>
<Member MemberName="WriteIf">
<MemberSignature Language="C#" Value="public static void WriteIf (bool condition, string message);" />
<MemberSignature Language="ILAsm" Value=".method public static hidebysig void WriteIf(bool condition, string message) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Diagnostics.Trace.WriteIf(System.Boolean,System.String)" />
<MemberSignature Language="VB.NET" Value="Public Shared Sub WriteIf (condition As Boolean, message As String)" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; static void WriteIf(bool condition, System::String ^ message);" />
<MemberSignature Language="F#" Value="static member WriteIf : bool * string -&gt; unit" Usage="System.Diagnostics.Trace.WriteIf (condition, message)" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Diagnostics.TraceSource</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.1.1.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netcore-1.0;netcore-1.1;netcore-2.0;netcore-2.1;netframework-1.1;netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netstandard-2.0;xamarinandroid-7.1;xamarinios-10.8;xamarinmac-3.0;netframework-4.8;netcore-2.2;netcore-3.0;netstandard-2.1">
<AttributeName>System.Diagnostics.Conditional("TRACE")</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="condition" Type="System.Boolean" />
<Parameter Name="message" Type="System.String" />
</Parameters>
<Docs>
<param name="condition">
<see langword="true" /> to cause a message to be written; otherwise, <see langword="false" />.</param>
<param name="message">A message to write.</param>
<summary>Writes a message to the trace listeners in the <see cref="P:System.Diagnostics.Trace.Listeners" /> collection if a condition is <see langword="true" />.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
By default, the output is written to an instance of <xref:System.Diagnostics.DefaultTraceListener>.
This method calls the <xref:System.Diagnostics.TraceListener.Write%2A> method of the trace listener.
## Examples
The following example creates a <xref:System.Diagnostics.TraceSwitch> named `generalSwitch`. This switch is set outside the code sample.
If the switch is set to the <xref:System.Diagnostics.TraceLevel>`Error` or higher, the example outputs the first error message to the <xref:System.Diagnostics.Trace.Listeners%2A>. For information on adding a listener to the <xref:System.Diagnostics.Trace.Listeners%2A> collection, see the <xref:System.Diagnostics.TraceListenerCollection> class.
Then, if the <xref:System.Diagnostics.TraceLevel> is set to `Verbose`, the example outputs the second error message on the same line as the first message. The second message is followed by a line terminator.
[!code-cpp[Classic Trace.WriteIf Example#1](~/samples/snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.WriteIf Example/CPP/source.cpp#1)]
[!code-csharp[Classic Trace.WriteIf Example#1](~/samples/snippets/csharp/VS_Snippets_CLR_Classic/classic Trace.WriteIf Example/CS/source.cs#1)]
[!code-vb[Classic Trace.WriteIf Example#1](~/samples/snippets/visualbasic/VS_Snippets_CLR_Classic/classic Trace.WriteIf Example/VB/source.vb#1)]
]]></format>
</remarks>
<block subset="none" type="overrides">
<para>You can minimize the performance penalty of instrumenting your application by using <see langword="If...Then" /> statements instead of using <see cref="M:System.Diagnostics.Trace.WriteIf(System.Boolean,System.String)" /> statements. The following two code examples send the same debugging message. However, the first example is much faster when tracing is off, because if <c>mySwitch.TraceError</c> evaluates to <see langword="false" /> you do not call <see cref="M:System.Diagnostics.Trace.Write(System.String)" />. The second example always calls <see cref="M:System.Diagnostics.Trace.WriteIf(System.Boolean,System.String)" />, even when <c>mySwitch.TraceError</c> is <see langword="false" /> and no tracing output is produced. This can result in unnecessary execution of arbitrarily complex code.
**First example**
```csharp
if(mySwitch.TraceError)
Trace.Write("aNumber = " + aNumber + " out of range");
```
**Second example**
```csharp
Trace.WriteIf(mySwitch.TraceError, "aNumber = " + aNumber + " out of range");
```</para>
</block>
<altmember cref="T:System.Diagnostics.Debug" />
<altmember cref="T:System.Diagnostics.Trace" />
<altmember cref="T:System.Diagnostics.BooleanSwitch" />
<altmember cref="T:System.Diagnostics.TraceSwitch" />
<altmember cref="T:System.Diagnostics.TraceListener" />
<altmember cref="T:System.Diagnostics.DefaultTraceListener" />
<altmember cref="T:System.Diagnostics.ConditionalAttribute" />
</Docs>
</Member>
<Member MemberName="WriteIf">
<MemberSignature Language="C#" Value="public static void WriteIf (bool condition, object value, string category);" />
<MemberSignature Language="ILAsm" Value=".method public static hidebysig void WriteIf(bool condition, object value, string category) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Diagnostics.Trace.WriteIf(System.Boolean,System.Object,System.String)" />
<MemberSignature Language="VB.NET" Value="Public Shared Sub WriteIf (condition As Boolean, value As Object, category As String)" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; static void WriteIf(bool condition, System::Object ^ value, System::String ^ category);" />
<MemberSignature Language="F#" Value="static member WriteIf : bool * obj * string -&gt; unit" Usage="System.Diagnostics.Trace.WriteIf (condition, value, category)" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Diagnostics.TraceSource</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.1.1.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netcore-1.0;netcore-1.1;netcore-2.0;netcore-2.1;netframework-1.1;netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netstandard-2.0;xamarinandroid-7.1;xamarinios-10.8;xamarinmac-3.0;netframework-4.8;netcore-2.2;netcore-3.0;netstandard-2.1">
<AttributeName>System.Diagnostics.Conditional("TRACE")</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="condition" Type="System.Boolean" />
<Parameter Name="value" Type="System.Object" />
<Parameter Name="category" Type="System.String" />
</Parameters>
<Docs>
<param name="condition">
<see langword="true" /> to cause a message to be written; otherwise, <see langword="false" />.</param>
<param name="value">An <see cref="T:System.Object" /> whose name is sent to the <see cref="P:System.Diagnostics.Trace.Listeners" />.</param>
<param name="category">A category name used to organize the output.</param>
<summary>Writes a category name and the value of the object's <see cref="M:System.Object.ToString" /> method to the trace listeners in the <see cref="P:System.Diagnostics.Trace.Listeners" /> collection if a condition is <see langword="true" />.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
By default, the output is written to an instance of <xref:System.Diagnostics.DefaultTraceListener>.
The `category` parameter can be used to group output messages.
This method calls the <xref:System.Diagnostics.TraceListener.Write%2A> method of the trace listener.
## Examples
The following example creates a <xref:System.Diagnostics.TraceSwitch> named `generalSwitch`. This switch is set outside the code sample.
If the switch is set to the <xref:System.Diagnostics.TraceLevel>`Verbose`, the example outputs the name of the `myObject` and the `category` to the <xref:System.Diagnostics.Trace.Listeners%2A>. For information on adding a listener to the <xref:System.Diagnostics.Trace.Listeners%2A> collection, see the <xref:System.Diagnostics.TraceListenerCollection> class.
Then, if the <xref:System.Diagnostics.TraceLevel> is set to `Error` or higher, the example outputs the second error message on the same line as the first message. The second message is followed by a line terminator.
[!code-cpp[Classic Trace.WriteIf3 Example#1](~/samples/snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.WriteIf3 Example/CPP/source.cpp#1)]
[!code-csharp[Classic Trace.WriteIf3 Example#1](~/samples/snippets/csharp/VS_Snippets_CLR_Classic/classic Trace.WriteIf3 Example/CS/source.cs#1)]
[!code-vb[Classic Trace.WriteIf3 Example#1](~/samples/snippets/visualbasic/VS_Snippets_CLR_Classic/classic Trace.WriteIf3 Example/VB/source.vb#1)]
]]></format>
</remarks>
<block subset="none" type="overrides">
<para>You can minimize the performance penalty of instrumenting your application by using <see langword="If...Then" /> statements instead of using <see cref="M:System.Diagnostics.Trace.WriteIf(System.Boolean,System.String)" /> statements. The following two code examples send the same debugging message. However, the first example is much faster when tracing is off, because if <c>mySwitch.TraceError</c> evaluates to <see langword="false" /> you do not call <see cref="M:System.Diagnostics.Trace.Write(System.String)" />. The second example always calls <see cref="M:System.Diagnostics.Trace.WriteIf(System.Boolean,System.String)" />, even when <c>mySwitch.TraceError</c> is <see langword="false" /> and no tracing output is produced. This can result in unnecessary execution of arbitrarily complex code.
**First example**
```csharp
if(mySwitch.TraceError)
Trace.Write("aNumber = " + aNumber + " out of range");
```
**Second example**
```csharp
Trace.WriteIf(mySwitch.TraceError, "aNumber = " + aNumber + " out of range");
```</para>
</block>
<altmember cref="T:System.Diagnostics.Debug" />
<altmember cref="T:System.Diagnostics.Trace" />
<altmember cref="T:System.Diagnostics.BooleanSwitch" />
<altmember cref="T:System.Diagnostics.TraceSwitch" />
<altmember cref="T:System.Diagnostics.TraceListener" />
<altmember cref="T:System.Diagnostics.DefaultTraceListener" />
<altmember cref="T:System.Diagnostics.ConditionalAttribute" />
</Docs>
</Member>
<Member MemberName="WriteIf">
<MemberSignature Language="C#" Value="public static void WriteIf (bool condition, string message, string category);" />
<MemberSignature Language="ILAsm" Value=".method public static hidebysig void WriteIf(bool condition, string message, string category) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Diagnostics.Trace.WriteIf(System.Boolean,System.String,System.String)" />
<MemberSignature Language="VB.NET" Value="Public Shared Sub WriteIf (condition As Boolean, message As String, category As String)" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; static void WriteIf(bool condition, System::String ^ message, System::String ^ category);" />
<MemberSignature Language="F#" Value="static member WriteIf : bool * string * string -&gt; unit" Usage="System.Diagnostics.Trace.WriteIf (condition, message, category)" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Diagnostics.TraceSource</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.1.1.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netcore-1.0;netcore-1.1;netcore-2.0;netcore-2.1;netframework-1.1;netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netstandard-2.0;xamarinandroid-7.1;xamarinios-10.8;xamarinmac-3.0;netframework-4.8;netcore-2.2;netcore-3.0;netstandard-2.1">
<AttributeName>System.Diagnostics.Conditional("TRACE")</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="condition" Type="System.Boolean" />
<Parameter Name="message" Type="System.String" />
<Parameter Name="category" Type="System.String" />
</Parameters>
<Docs>
<param name="condition">
<see langword="true" /> to cause a message to be written; otherwise, <see langword="false" />.</param>
<param name="message">A message to write.</param>
<param name="category">A category name used to organize the output.</param>
<summary>Writes a category name and message to the trace listeners in the <see cref="P:System.Diagnostics.Trace.Listeners" /> collection if a condition is <see langword="true" />.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
By default, the output is written to an instance of <xref:System.Diagnostics.DefaultTraceListener>.
The `category` parameter can be used to group output messages.
This method calls the <xref:System.Diagnostics.TraceListener.Write%2A> method of the trace listener.
## Examples
The following example creates a <xref:System.Diagnostics.TraceSwitch> named `generalSwitch`. This switch is set outside the code sample.
If the switch is set to the <xref:System.Diagnostics.TraceLevel>`Verbose`, the example outputs the first error message to the <xref:System.Diagnostics.Trace.Listeners%2A>. For information on adding a listener to the <xref:System.Diagnostics.Trace.Listeners%2A> collection, see the <xref:System.Diagnostics.TraceListenerCollection> class.
Then, if the <xref:System.Diagnostics.TraceLevel> is set to `Error` or higher, the example outputs the second error message on the same line as the first message. The second message is followed by a line terminator.
[!code-cpp[Classic Trace.WriteIf2 Example#1](~/samples/snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.WriteIf2 Example/CPP/source.cpp#1)]
[!code-csharp[Classic Trace.WriteIf2 Example#1](~/samples/snippets/csharp/VS_Snippets_CLR_Classic/classic Trace.WriteIf2 Example/CS/source.cs#1)]
[!code-vb[Classic Trace.WriteIf2 Example#1](~/samples/snippets/visualbasic/VS_Snippets_CLR_Classic/classic Trace.WriteIf2 Example/VB/source.vb#1)]
]]></format>
</remarks>
<block subset="none" type="overrides">
<para>You can minimize the performance penalty of instrumenting your application by using <see langword="If...Then" /> statements instead of using <see cref="M:System.Diagnostics.Trace.WriteIf(System.Boolean,System.String)" /> statements. The following two code examples send the same debugging message. However, the first example is much faster when tracing is off, because if <c>mySwitch.TraceError</c> evaluates to <see langword="false" /> you do not call <see cref="M:System.Diagnostics.Trace.Write(System.String)" />. The second example always calls <see cref="M:System.Diagnostics.Trace.WriteIf(System.Boolean,System.String)" />, even when <c>mySwitch.TraceError</c> is <see langword="false" /> and no tracing output is produced. This can result in unnecessary execution of arbitrarily complex code.
**First example**
```csharp
if(mySwitch.TraceError)
Trace.Write("aNumber = " + aNumber + " out of range");
```
**Second example**
```csharp
Trace.WriteIf(mySwitch.TraceError, "aNumber = " + aNumber + " out of range");
```</para>
</block>
<altmember cref="T:System.Diagnostics.Debug" />
<altmember cref="T:System.Diagnostics.Trace" />
<altmember cref="T:System.Diagnostics.BooleanSwitch" />
<altmember cref="T:System.Diagnostics.TraceSwitch" />
<altmember cref="T:System.Diagnostics.TraceListener" />
<altmember cref="T:System.Diagnostics.DefaultTraceListener" />
<altmember cref="T:System.Diagnostics.ConditionalAttribute" />
</Docs>
</Member>
<MemberGroup MemberName="WriteLine">
<AssemblyInfo>
<AssemblyName>System.Diagnostics.TraceSource</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
</AssemblyInfo>
<Docs>
<summary>Writes information about the trace to the trace listeners in the <see cref="P:System.Diagnostics.Trace.Listeners" /> collection.</summary>
</Docs>
</MemberGroup>
<Member MemberName="WriteLine">
<MemberSignature Language="C#" Value="public static void WriteLine (object value);" />
<MemberSignature Language="ILAsm" Value=".method public static hidebysig void WriteLine(object value) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Diagnostics.Trace.WriteLine(System.Object)" />
<MemberSignature Language="VB.NET" Value="Public Shared Sub WriteLine (value As Object)" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; static void WriteLine(System::Object ^ value);" />
<MemberSignature Language="F#" Value="static member WriteLine : obj -&gt; unit" Usage="System.Diagnostics.Trace.WriteLine value" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Diagnostics.TraceSource</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.1.1.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netcore-1.0;netcore-1.1;netcore-2.0;netcore-2.1;netframework-1.1;netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netstandard-2.0;xamarinandroid-7.1;xamarinios-10.8;xamarinmac-3.0;netframework-4.8;netcore-2.2;netcore-3.0;netstandard-2.1">
<AttributeName>System.Diagnostics.Conditional("TRACE")</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="value" Type="System.Object" />
</Parameters>
<Docs>
<param name="value">An <see cref="T:System.Object" /> whose name is sent to the <see cref="P:System.Diagnostics.Trace.Listeners" />.</param>
<summary>Writes the value of the object's <see cref="M:System.Object.ToString" /> method to the trace listeners in the <see cref="P:System.Diagnostics.Trace.Listeners" /> collection.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
By default, the output is written to an instance of <xref:System.Diagnostics.DefaultTraceListener>.
This method calls the <xref:System.Diagnostics.TraceListener.WriteLine%2A> method of the trace listener.
## Examples
The following example creates a <xref:System.Diagnostics.TraceSwitch> named `generalSwitch`. This switch is set outside the code sample.
If the switch is set to the <xref:System.Diagnostics.TraceLevel>`Error` or higher, the example outputs the first error message to the <xref:System.Diagnostics.Trace.Listeners%2A>. For information on adding a listener to the <xref:System.Diagnostics.Trace.Listeners%2A> collection, see the <xref:System.Diagnostics.TraceListenerCollection> class.
Then, if the <xref:System.Diagnostics.TraceLevel> is set to `Verbose`, the example outputs the name of the object on the same line as the first message. The second message is followed by a line terminator.
[!code-cpp[Classic Trace.WriteLine1 Example#1](~/samples/snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.WriteLine1 Example/CPP/source.cpp#1)]
[!code-csharp[Classic Trace.WriteLine1 Example#1](~/samples/snippets/csharp/VS_Snippets_CLR_Classic/classic Trace.WriteLine1 Example/CS/source.cs#1)]
[!code-vb[Classic Trace.WriteLine1 Example#1](~/samples/snippets/visualbasic/VS_Snippets_CLR_Classic/classic Trace.WriteLine1 Example/VB/source.vb#1)]
]]></format>
</remarks>
<altmember cref="T:System.Diagnostics.Debug" />
<altmember cref="T:System.Diagnostics.Trace" />
<altmember cref="T:System.Diagnostics.BooleanSwitch" />
<altmember cref="T:System.Diagnostics.TraceSwitch" />
<altmember cref="T:System.Diagnostics.TraceListener" />
<altmember cref="T:System.Diagnostics.DefaultTraceListener" />
<altmember cref="T:System.Diagnostics.ConditionalAttribute" />
</Docs>
</Member>
<Member MemberName="WriteLine">
<MemberSignature Language="C#" Value="public static void WriteLine (string message);" />
<MemberSignature Language="ILAsm" Value=".method public static hidebysig void WriteLine(string message) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Diagnostics.Trace.WriteLine(System.String)" />
<MemberSignature Language="VB.NET" Value="Public Shared Sub WriteLine (message As String)" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; static void WriteLine(System::String ^ message);" />
<MemberSignature Language="F#" Value="static member WriteLine : string -&gt; unit" Usage="System.Diagnostics.Trace.WriteLine message" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Diagnostics.TraceSource</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.1.1.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netcore-1.0;netcore-1.1;netcore-2.0;netcore-2.1;netframework-1.1;netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netstandard-2.0;xamarinandroid-7.1;xamarinios-10.8;xamarinmac-3.0;netframework-4.8;netcore-2.2;netcore-3.0;netstandard-2.1">
<AttributeName>System.Diagnostics.Conditional("TRACE")</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="message" Type="System.String" />
</Parameters>
<Docs>
<param name="message">A message to write.</param>
<summary>Writes a message to the trace listeners in the <see cref="P:System.Diagnostics.Trace.Listeners" /> collection.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
By default, the output is written to an instance of <xref:System.Diagnostics.DefaultTraceListener>.
This method calls the <xref:System.Diagnostics.TraceListener.WriteLine%2A> method of the trace listener.
## Examples
The following example creates a <xref:System.Diagnostics.TraceSwitch> named `generalSwitch`. This switch is set outside the code sample.
If the switch is set to the <xref:System.Diagnostics.TraceLevel>`Error` or higher, the example outputs the first error message to the <xref:System.Diagnostics.Trace.Listeners%2A>. For information on adding a listener to the <xref:System.Diagnostics.Trace.Listeners%2A> collection, see the <xref:System.Diagnostics.TraceListenerCollection> class.
Then, if the <xref:System.Diagnostics.TraceLevel> is set to `Verbose`, the example outputs the second error message on the same line as the first message. The second message is followed by a line terminator.
[!code-cpp[Classic Trace.Write Example#1](~/samples/snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.Write Example/CPP/source.cpp#1)]
[!code-csharp[Classic Trace.Write Example#1](~/samples/snippets/csharp/VS_Snippets_CLR_Classic/classic Trace.Write Example/CS/source.cs#1)]
[!code-vb[Classic Trace.Write Example#1](~/samples/snippets/visualbasic/VS_Snippets_CLR_Classic/classic Trace.Write Example/VB/source.vb#1)]
]]></format>
</remarks>
<altmember cref="T:System.Diagnostics.Debug" />
<altmember cref="T:System.Diagnostics.Trace" />
<altmember cref="T:System.Diagnostics.BooleanSwitch" />
<altmember cref="T:System.Diagnostics.TraceSwitch" />
<altmember cref="T:System.Diagnostics.TraceListener" />
<altmember cref="T:System.Diagnostics.DefaultTraceListener" />
<altmember cref="T:System.Diagnostics.ConditionalAttribute" />
</Docs>
</Member>
<Member MemberName="WriteLine">
<MemberSignature Language="C#" Value="public static void WriteLine (object value, string category);" />
<MemberSignature Language="ILAsm" Value=".method public static hidebysig void WriteLine(object value, string category) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Diagnostics.Trace.WriteLine(System.Object,System.String)" />
<MemberSignature Language="VB.NET" Value="Public Shared Sub WriteLine (value As Object, category As String)" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; static void WriteLine(System::Object ^ value, System::String ^ category);" />
<MemberSignature Language="F#" Value="static member WriteLine : obj * string -&gt; unit" Usage="System.Diagnostics.Trace.WriteLine (value, category)" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Diagnostics.TraceSource</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.1.1.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netcore-1.0;netcore-1.1;netcore-2.0;netcore-2.1;netframework-1.1;netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netstandard-2.0;xamarinandroid-7.1;xamarinios-10.8;xamarinmac-3.0;netframework-4.8;netcore-2.2;netcore-3.0;netstandard-2.1">
<AttributeName>System.Diagnostics.Conditional("TRACE")</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="value" Type="System.Object" />
<Parameter Name="category" Type="System.String" />
</Parameters>
<Docs>
<param name="value">An <see cref="T:System.Object" /> whose name is sent to the <see cref="P:System.Diagnostics.Trace.Listeners" />.</param>
<param name="category">A category name used to organize the output.</param>
<summary>Writes a category name and the value of the object's <see cref="M:System.Object.ToString" /> method to the trace listeners in the <see cref="P:System.Diagnostics.Trace.Listeners" /> collection.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
By default, the output is written to an instance of <xref:System.Diagnostics.DefaultTraceListener>.
The `category` parameter can be used to group output messages.
This method calls the <xref:System.Diagnostics.TraceListener.WriteLine%2A> method of the trace listener.
## Examples
The following example creates a <xref:System.Diagnostics.TraceSwitch> named `generalSwitch`. This switch is set outside the code sample.
If the switch is set to the <xref:System.Diagnostics.TraceLevel>`Error` or higher, the example outputs the first error message to the <xref:System.Diagnostics.Trace.Listeners%2A>. For information on adding a listener to the <xref:System.Diagnostics.Trace.Listeners%2A> collection, see the <xref:System.Diagnostics.TraceListenerCollection> class.
Then, if the <xref:System.Diagnostics.TraceLevel> is set to `Verbose`, the example outputs the second error message on the same line as the first message. The second message is followed by a line terminator.
[!code-cpp[Classic Trace.WriteLine3 Example#1](~/samples/snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.WriteLine3 Example/CPP/source.cpp#1)]
[!code-csharp[Classic Trace.WriteLine3 Example#1](~/samples/snippets/csharp/VS_Snippets_CLR_Classic/classic Trace.WriteLine3 Example/CS/source.cs#1)]
[!code-vb[Classic Trace.WriteLine3 Example#1](~/samples/snippets/visualbasic/VS_Snippets_CLR_Classic/classic Trace.WriteLine3 Example/VB/source.vb#1)]
]]></format>
</remarks>
<altmember cref="T:System.Diagnostics.Debug" />
<altmember cref="T:System.Diagnostics.Trace" />
<altmember cref="T:System.Diagnostics.BooleanSwitch" />
<altmember cref="T:System.Diagnostics.TraceSwitch" />
<altmember cref="T:System.Diagnostics.TraceListener" />
<altmember cref="T:System.Diagnostics.DefaultTraceListener" />
<altmember cref="T:System.Diagnostics.ConditionalAttribute" />
</Docs>
</Member>
<Member MemberName="WriteLine">
<MemberSignature Language="C#" Value="public static void WriteLine (string message, string category);" />
<MemberSignature Language="ILAsm" Value=".method public static hidebysig void WriteLine(string message, string category) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Diagnostics.Trace.WriteLine(System.String,System.String)" />
<MemberSignature Language="VB.NET" Value="Public Shared Sub WriteLine (message As String, category As String)" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; static void WriteLine(System::String ^ message, System::String ^ category);" />
<MemberSignature Language="F#" Value="static member WriteLine : string * string -&gt; unit" Usage="System.Diagnostics.Trace.WriteLine (message, category)" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Diagnostics.TraceSource</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.1.1.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netcore-1.0;netcore-1.1;netcore-2.0;netcore-2.1;netframework-1.1;netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netstandard-2.0;xamarinandroid-7.1;xamarinios-10.8;xamarinmac-3.0;netframework-4.8;netcore-2.2;netcore-3.0;netstandard-2.1">
<AttributeName>System.Diagnostics.Conditional("TRACE")</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="message" Type="System.String" />
<Parameter Name="category" Type="System.String" />
</Parameters>
<Docs>
<param name="message">A message to write.</param>
<param name="category">A category name used to organize the output.</param>
<summary>Writes a category name and message to the trace listeners in the <see cref="P:System.Diagnostics.Trace.Listeners" /> collection.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
By default, the output is written to an instance of <xref:System.Diagnostics.DefaultTraceListener>.
The `category` parameter can be used to group output messages.
This method calls the <xref:System.Diagnostics.TraceListener.WriteLine%2A> method of the trace listener.
## Examples
The following example creates a <xref:System.Diagnostics.TraceSwitch> named `generalSwitch`. This switch is set outside the code sample.
If the switch is set to the <xref:System.Diagnostics.TraceLevel>`Error` or higher, the example outputs the first error message to the <xref:System.Diagnostics.Trace.Listeners%2A>. For information on adding a listener to the <xref:System.Diagnostics.Trace.Listeners%2A> collection, see the <xref:System.Diagnostics.TraceListenerCollection> class.
Then, if the <xref:System.Diagnostics.TraceLevel> is set to `Verbose`, the example outputs the second error message and the `category` on the same line as the first message. The second message is followed by a line terminator.
[!code-cpp[Classic Trace.WriteLine2 Example#1](~/samples/snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.WriteLine2 Example/CPP/source.cpp#1)]
[!code-csharp[Classic Trace.WriteLine2 Example#1](~/samples/snippets/csharp/VS_Snippets_CLR_Classic/classic Trace.WriteLine2 Example/CS/source.cs#1)]
[!code-vb[Classic Trace.WriteLine2 Example#1](~/samples/snippets/visualbasic/VS_Snippets_CLR_Classic/classic Trace.WriteLine2 Example/VB/source.vb#1)]
]]></format>
</remarks>
<altmember cref="T:System.Diagnostics.Debug" />
<altmember cref="T:System.Diagnostics.Trace" />
<altmember cref="T:System.Diagnostics.BooleanSwitch" />
<altmember cref="T:System.Diagnostics.TraceSwitch" />
<altmember cref="T:System.Diagnostics.TraceListener" />
<altmember cref="T:System.Diagnostics.DefaultTraceListener" />
<altmember cref="T:System.Diagnostics.ConditionalAttribute" />
</Docs>
</Member>
<MemberGroup MemberName="WriteLineIf">
<AssemblyInfo>
<AssemblyName>System.Diagnostics.TraceSource</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
</AssemblyInfo>
<Docs>
<summary>Writes information about the trace to the trace listeners in the <see cref="P:System.Diagnostics.Trace.Listeners" /> collection if a condition is <see langword="true" />.</summary>
</Docs>
</MemberGroup>
<Member MemberName="WriteLineIf">
<MemberSignature Language="C#" Value="public static void WriteLineIf (bool condition, object value);" />
<MemberSignature Language="ILAsm" Value=".method public static hidebysig void WriteLineIf(bool condition, object value) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Diagnostics.Trace.WriteLineIf(System.Boolean,System.Object)" />
<MemberSignature Language="VB.NET" Value="Public Shared Sub WriteLineIf (condition As Boolean, value As Object)" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; static void WriteLineIf(bool condition, System::Object ^ value);" />
<MemberSignature Language="F#" Value="static member WriteLineIf : bool * obj -&gt; unit" Usage="System.Diagnostics.Trace.WriteLineIf (condition, value)" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Diagnostics.TraceSource</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.1.1.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netcore-1.0;netcore-1.1;netcore-2.0;netcore-2.1;netframework-1.1;netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netstandard-2.0;xamarinandroid-7.1;xamarinios-10.8;xamarinmac-3.0;netframework-4.8;netcore-2.2;netcore-3.0;netstandard-2.1">
<AttributeName>System.Diagnostics.Conditional("TRACE")</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="condition" Type="System.Boolean" />
<Parameter Name="value" Type="System.Object" />
</Parameters>
<Docs>
<param name="condition">
<see langword="true" /> to cause a message to be written; otherwise, <see langword="false" />.</param>
<param name="value">An <see cref="T:System.Object" /> whose name is sent to the <see cref="P:System.Diagnostics.Trace.Listeners" />.</param>
<summary>Writes the value of the object's <see cref="M:System.Object.ToString" /> method to the trace listeners in the <see cref="P:System.Diagnostics.Trace.Listeners" /> collection if a condition is <see langword="true" />.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
By default, the output is written to an instance of <xref:System.Diagnostics.DefaultTraceListener>.
This method calls the <xref:System.Diagnostics.TraceListener.WriteLine%2A> method of the trace listener.
## Examples
The following example creates a <xref:System.Diagnostics.TraceSwitch> named `generalSwitch`. This switch is set outside the code sample.
If the switch is set to the <xref:System.Diagnostics.TraceLevel>`Error` or higher, the example outputs the first error message to the <xref:System.Diagnostics.Trace.Listeners%2A>. For information on adding a listener to the <xref:System.Diagnostics.Trace.Listeners%2A> collection, see the <xref:System.Diagnostics.TraceListenerCollection> class.
Then, if the <xref:System.Diagnostics.TraceLevel> is set to `Verbose`, the example outputs the name of the object on the same line as the first message. The second message is followed by a line terminator.
[!code-cpp[Classic Trace.WriteLineIf1 Example#1](~/samples/snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.WriteLineIf1 Example/CPP/source.cpp#1)]
[!code-csharp[Classic Trace.WriteLineIf1 Example#1](~/samples/snippets/csharp/VS_Snippets_CLR_Classic/classic Trace.WriteLineIf1 Example/CS/source.cs#1)]
[!code-vb[Classic Trace.WriteLineIf1 Example#1](~/samples/snippets/visualbasic/VS_Snippets_CLR_Classic/classic Trace.WriteLineIf1 Example/VB/source.vb#1)]
]]></format>
</remarks>
<block subset="none" type="overrides">
<para>You can minimize the performance penalty of instrumenting your application by using <see langword="If...Then" /> statements instead of using <see cref="M:System.Diagnostics.Trace.WriteLineIf(System.Boolean,System.String)" /> statements. The following two code examples send the same debugging message. However, the first example is much faster when tracing is off, because if <c>mySwitch.TraceError</c> evaluates to <see langword="false" /> you do not call <see cref="M:System.Diagnostics.Trace.WriteLine(System.String)" />. The second example always calls <see cref="M:System.Diagnostics.Trace.WriteLineIf(System.Boolean,System.String)" />, even when <c>mySwitch.TraceError</c> is <see langword="false" /> and no tracing output is produced. This can result in unnecessary execution of arbitrarily complex code.
**First example**
```csharp
if(mySwitch.TraceError)
Trace.WriteLine("aNumber = " + aNumber + " out of range");
```
**Second example**
```csharp
Trace.WriteLineIf(mySwitch.TraceError, "aNumber = " + aNumber + " out of range");
```</para>
</block>
<altmember cref="T:System.Diagnostics.Debug" />
<altmember cref="T:System.Diagnostics.Trace" />
<altmember cref="T:System.Diagnostics.BooleanSwitch" />
<altmember cref="T:System.Diagnostics.TraceSwitch" />
<altmember cref="T:System.Diagnostics.TraceListener" />
<altmember cref="T:System.Diagnostics.DefaultTraceListener" />
<altmember cref="T:System.Diagnostics.ConditionalAttribute" />
</Docs>
</Member>
<Member MemberName="WriteLineIf">
<MemberSignature Language="C#" Value="public static void WriteLineIf (bool condition, string message);" />
<MemberSignature Language="ILAsm" Value=".method public static hidebysig void WriteLineIf(bool condition, string message) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Diagnostics.Trace.WriteLineIf(System.Boolean,System.String)" />
<MemberSignature Language="VB.NET" Value="Public Shared Sub WriteLineIf (condition As Boolean, message As String)" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; static void WriteLineIf(bool condition, System::String ^ message);" />
<MemberSignature Language="F#" Value="static member WriteLineIf : bool * string -&gt; unit" Usage="System.Diagnostics.Trace.WriteLineIf (condition, message)" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Diagnostics.TraceSource</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.1.1.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netcore-1.0;netcore-1.1;netcore-2.0;netcore-2.1;netframework-1.1;netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netstandard-2.0;xamarinandroid-7.1;xamarinios-10.8;xamarinmac-3.0;netframework-4.8;netcore-2.2;netcore-3.0;netstandard-2.1">
<AttributeName>System.Diagnostics.Conditional("TRACE")</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="condition" Type="System.Boolean" />
<Parameter Name="message" Type="System.String" />
</Parameters>
<Docs>
<param name="condition">
<see langword="true" /> to cause a message to be written; otherwise, <see langword="false" />.</param>
<param name="message">A message to write.</param>
<summary>Writes a message to the trace listeners in the <see cref="P:System.Diagnostics.Trace.Listeners" /> collection if a condition is <see langword="true" />.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
By default, the output is written to an instance of <xref:System.Diagnostics.DefaultTraceListener>.
This method calls the <xref:System.Diagnostics.TraceListener.WriteLine%2A> method of the trace listener.
## Examples
The following example creates a <xref:System.Diagnostics.TraceSwitch> named `generalSwitch`. This switch is set outside the code sample.
If the switch is set to the <xref:System.Diagnostics.TraceLevel>`Error` or higher, the example outputs the first error message to the <xref:System.Diagnostics.Trace.Listeners%2A>. For information on adding a listener to the <xref:System.Diagnostics.Trace.Listeners%2A> collection, see the <xref:System.Diagnostics.TraceListenerCollection> class.
Then, if the <xref:System.Diagnostics.TraceLevel> is set to `Verbose`, the example outputs the second error message on the same line as the first message. The second message is followed by a line terminator.
[!code-cpp[Classic Trace.WriteIf Example#1](~/samples/snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.WriteIf Example/CPP/source.cpp#1)]
[!code-csharp[Classic Trace.WriteIf Example#1](~/samples/snippets/csharp/VS_Snippets_CLR_Classic/classic Trace.WriteIf Example/CS/source.cs#1)]
[!code-vb[Classic Trace.WriteIf Example#1](~/samples/snippets/visualbasic/VS_Snippets_CLR_Classic/classic Trace.WriteIf Example/VB/source.vb#1)]
]]></format>
</remarks>
<block subset="none" type="overrides">
<para>You can minimize the performance penalty of instrumenting your application by using <see langword="If...Then" /> statements instead of using <see cref="M:System.Diagnostics.Trace.WriteLineIf(System.Boolean,System.String)" /> statements. The following two code examples send the same debugging message. However, the first example is much faster when tracing is off, because if <c>mySwitch.TraceError</c> evaluates to <see langword="false" /> you do not call <see cref="M:System.Diagnostics.Trace.WriteLine(System.String)" />. The second example always calls <see cref="M:System.Diagnostics.Trace.WriteLineIf(System.Boolean,System.String)" />, even when <c>mySwitch.TraceError</c> is <see langword="false" /> and no tracing output is produced. This can result in unnecessary execution of arbitrarily complex code.
**First example**
```csharp
if(mySwitch.TraceError)
Trace.WriteLine("aNumber = " + aNumber + " out of range");
```
**Second example**
```csharp
Trace.WriteLineIf(mySwitch.TraceError, "aNumber = " + aNumber + " out of range");
```</para>
</block>
<altmember cref="T:System.Diagnostics.Debug" />
<altmember cref="T:System.Diagnostics.Trace" />
<altmember cref="T:System.Diagnostics.BooleanSwitch" />
<altmember cref="T:System.Diagnostics.TraceSwitch" />
<altmember cref="T:System.Diagnostics.TraceListener" />
<altmember cref="T:System.Diagnostics.DefaultTraceListener" />
<altmember cref="T:System.Diagnostics.ConditionalAttribute" />
</Docs>
</Member>
<Member MemberName="WriteLineIf">
<MemberSignature Language="C#" Value="public static void WriteLineIf (bool condition, object value, string category);" />
<MemberSignature Language="ILAsm" Value=".method public static hidebysig void WriteLineIf(bool condition, object value, string category) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Diagnostics.Trace.WriteLineIf(System.Boolean,System.Object,System.String)" />
<MemberSignature Language="VB.NET" Value="Public Shared Sub WriteLineIf (condition As Boolean, value As Object, category As String)" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; static void WriteLineIf(bool condition, System::Object ^ value, System::String ^ category);" />
<MemberSignature Language="F#" Value="static member WriteLineIf : bool * obj * string -&gt; unit" Usage="System.Diagnostics.Trace.WriteLineIf (condition, value, category)" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Diagnostics.TraceSource</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.1.1.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netcore-1.0;netcore-1.1;netcore-2.0;netcore-2.1;netframework-1.1;netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netstandard-2.0;xamarinandroid-7.1;xamarinios-10.8;xamarinmac-3.0;netframework-4.8;netcore-2.2;netcore-3.0;netstandard-2.1">
<AttributeName>System.Diagnostics.Conditional("TRACE")</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="condition" Type="System.Boolean" />
<Parameter Name="value" Type="System.Object" />
<Parameter Name="category" Type="System.String" />
</Parameters>
<Docs>
<param name="condition">
<see langword="true" /> to cause a message to be written; otherwise, <see langword="false" />.</param>
<param name="value">An <see cref="T:System.Object" /> whose name is sent to the <see cref="P:System.Diagnostics.Trace.Listeners" />.</param>
<param name="category">A category name used to organize the output.</param>
<summary>Writes a category name and the value of the object's <see cref="M:System.Object.ToString" /> method to the trace listeners in the <see cref="P:System.Diagnostics.Trace.Listeners" /> collection if a condition is <see langword="true" />.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
By default, the output is written to an instance of <xref:System.Diagnostics.DefaultTraceListener>.
The `category` parameter can be used to group output messages.
This method calls the <xref:System.Diagnostics.TraceListener.WriteLine%2A> method of the trace listener.
## Examples
The following example creates a <xref:System.Diagnostics.TraceSwitch> named `generalSwitch`. This switch is set outside the code sample.
If the switch is set to the <xref:System.Diagnostics.TraceLevel>`Error` or higher, the example outputs the first error message to the <xref:System.Diagnostics.Trace.Listeners%2A>. For information on adding a listener to the <xref:System.Diagnostics.Trace.Listeners%2A> collection, see the <xref:System.Diagnostics.TraceListenerCollection> class.
Then, if the <xref:System.Diagnostics.TraceLevel> is set to `Verbose`, the example outputs the second error message on the same line as the first message. The second message is followed by a line terminator.
[!code-cpp[Classic Trace.WriteLineIf3 Example#1](~/samples/snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.WriteLineIf3 Example/CPP/source.cpp#1)]
[!code-csharp[Classic Trace.WriteLineIf3 Example#1](~/samples/snippets/csharp/VS_Snippets_CLR_Classic/classic Trace.WriteLineIf3 Example/CS/source.cs#1)]
[!code-vb[Classic Trace.WriteLineIf3 Example#1](~/samples/snippets/visualbasic/VS_Snippets_CLR_Classic/classic Trace.WriteLineIf3 Example/VB/source.vb#1)]
]]></format>
</remarks>
<block subset="none" type="overrides">
<para>You can minimize the performance penalty of instrumenting your application by using <see langword="If...Then" /> statements instead of using <see cref="M:System.Diagnostics.Trace.WriteLineIf(System.Boolean,System.String)" /> statements. The following two code examples send the same debugging message. However, the first example is much faster when tracing is off, because if <c>mySwitch.TraceError</c> evaluates to <see langword="false" /> you do not call <see cref="M:System.Diagnostics.Trace.WriteLine(System.String)" />. The second example always calls <see cref="M:System.Diagnostics.Trace.WriteLineIf(System.Boolean,System.String)" />, even when <c>mySwitch.TraceError</c> is <see langword="false" /> and no tracing output is produced. This can result in unnecessary execution of arbitrarily complex code.
**First example**
```csharp
if(mySwitch.TraceError)
Trace.WriteLine("aNumber = " + aNumber + " out of range");
```
**Second example**
```csharp
Trace.WriteLineIf(mySwitch.TraceError, "aNumber = " + aNumber + " out of range");
```</para>
</block>
<altmember cref="T:System.Diagnostics.Debug" />
<altmember cref="T:System.Diagnostics.Trace" />
<altmember cref="T:System.Diagnostics.BooleanSwitch" />
<altmember cref="T:System.Diagnostics.TraceSwitch" />
<altmember cref="T:System.Diagnostics.TraceListener" />
<altmember cref="T:System.Diagnostics.DefaultTraceListener" />
<altmember cref="T:System.Diagnostics.ConditionalAttribute" />
</Docs>
</Member>
<Member MemberName="WriteLineIf">
<MemberSignature Language="C#" Value="public static void WriteLineIf (bool condition, string message, string category);" />
<MemberSignature Language="ILAsm" Value=".method public static hidebysig void WriteLineIf(bool condition, string message, string category) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Diagnostics.Trace.Wri