/WCFWebApi/src/Microsoft.Server.Common/Microsoft/Server/Common/Diagnostics/DictionaryTraceRecord.cs
C# | 33 lines | 25 code | 5 blank | 3 comment | 3 complexity | f6d95d11ffa01109845576370a08541c MD5 | raw file
Possible License(s): CC-BY-SA-3.0, Apache-2.0
- //------------------------------------------------------------
- // Copyright (c) Microsoft Corporation. All rights reserved.
- //------------------------------------------------------------
-
- namespace Microsoft.Server.Common.Diagnostics
- {
- using System.Collections;
- using System.Xml;
-
- class DictionaryTraceRecord : TraceRecord
- {
- IDictionary dictionary;
-
- public DictionaryTraceRecord(IDictionary dictionary)
- {
- this.dictionary = dictionary;
- }
-
- public override string EventId { get { return TraceRecord.EventIdBase + "Dictionary" + TraceRecord.NamespaceSuffix; } }
-
- public override void WriteTo(XmlWriter xml)
- {
- if (this.dictionary != null)
- {
- foreach (object key in this.dictionary.Keys)
- {
- object value = this.dictionary[key];
- xml.WriteElementString(key.ToString(), value == null ? string.Empty : value.ToString());
- }
- }
- }
- }
- }