Title: No enumerable context anymore?

Sorry if this has been covered a million times.

I used to iterate through the MDC of a given LoggingEvent when rendering.  Something like this:

// Append the MDC values if any exist

if(loggingEvent.MappedContext != null && loggingEvent.MappedContext.Count > 0)

{

        foreach(DictionaryEntry entry in loggingEvent.MappedContext)

        {

                xTxtWriter.WriteStartElement(entry.Key.ToString());

                xTxtWriter.WriteString(entry.Value.ToString());

                xTxtWriter.WriteEndElement();

        }

}

The result would be something like:

<Property1>Value</Property1>
<Property2>Value</Property2>

How can I accomplish this with the new ThreadContextProperties?

Thanks!

Reply via email to