PropertyFilter Class

Trace filter that filters based on the value of a property.


Note: The functionality of this filter is superseeded by ExpressionFilter and it is only maintained for backwards compatibility.

The initializeData for this filter contains a single property comparison, e.g. initializeData="Id == 1".

The value must consist of a property name from one of the values supported by TraceFormatter, the C# equality operator (double equals signs) and then a single value. Matching quotes around the value are removed and whitespace (outside of any quotes) is ignored, e.g. "Id == 1" and " Id == '1' " are equivalent.

The property is converted to a string using TraceFormatter and then compared with the value.

Config Attributes

Attribute Description
initializeData Property name and value to compare to, e.g. " EventType == 'Warning' ".

Example Config

<?xml version="1.0" encoding="utf-8" ?>
      <add name="coloredconsole"
           type="Essential.Diagnostics.ColoredConsoleTraceListener, Essential.Diagnostics">
        <filter type="Essential.Diagnostics.PropertyFilter, Essential.Diagnostics"
                initializeData="Id == 1001" />
      <source name="ExampleSource" switchValue="All">
          <clear />
          <add name="coloredconsole" />

Last edited Nov 2, 2011 at 6:26 AM by sgryphon, version 2


No comments yet.