Επεξεργασία

Κοινή χρήση μέσω


UnescapedXmlDiagnosticData(String) Constructor

Definition

Initializes a new instance of the UnescapedXmlDiagnosticData class by using the specified XML data string.

public:
 UnescapedXmlDiagnosticData(System::String ^ xmlPayload);
public UnescapedXmlDiagnosticData (string xmlPayload);
new System.Diagnostics.UnescapedXmlDiagnosticData : string -> System.Diagnostics.UnescapedXmlDiagnosticData
Public Sub New (xmlPayload As String)

Parameters

xmlPayload
String

The XML data to be logged in the UserData node of the event schema.

Examples

The following code example demonstrates how to use the UnescapedXmlDiagnosticData constructor. This code example is part of a larger example that is provided for the EventSchemaTraceListener class.

string testString = "<Test><InnerElement Val=\"1\" /><InnerElement Val=\"Data\"/><AnotherElement>11</AnotherElement></Test>";
UnescapedXmlDiagnosticData unXData = new UnescapedXmlDiagnosticData(testString);
ts.TraceData(TraceEventType.Error, 38, unXData);
Dim testString As String = "<Test><InnerElement Val=""1"" /><InnerElement Val=""Data""/><AnotherElement>11</AnotherElement></Test>"
Dim unXData As New UnescapedXmlDiagnosticData(testString)
ts.TraceData(TraceEventType.Error, 38, unXData)

Remarks

If you want your code to be end-to-end schema-compliant, the xmlPayload parameter must be an XML fragment that can be validated against the end-to-end event schema. If xmlPayload is null, the UnescapedXml property is an empty string.

Note

xmlPayload is not checked for XML validity.

Applies to