/// <inheritdoc /> public override bool TryGetValue(out object value, System.Diagnostics.TraceEventCache cache, string source, System.Diagnostics.TraceEventType eventType, int id, string formatOrMessage, object[] data) { object result = null; if (_wrappedPropertyReader.TryGetValue(out result, cache, source, eventType, id, formatOrMessage, data)) { PropertyResult pr = _fastPropertyGetter.GetValue(result); value = pr.Data; return(pr.ObjectMatched); } value = null; return(false); }
/// <inheritdoc /> /// <remarks> /// This method calls the underlying property reader to obtain its value, and then if the obeject returned implements /// the <see cref="System.IFormattable"/> interface we then call .ToString(FormatString) on it and return the /// formatted version of the data. /// </remarks> public override bool TryGetValue(out object value, TraceEventCache cache, string source, TraceEventType eventType, int id, string formatOrMessage, object[] data) { object subval = null; if (_wrappedPropertyReader.TryGetValue(out subval, cache, source, eventType, id, formatOrMessage, data)) { value = subval; IFormattable formattable = subval as IFormattable; if (formattable != null) { value = formattable.ToString(FormatString, CultureInfo.InvariantCulture); } return(true); } value = null; return(false); }