Exemple #1
0
        /// <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);
        }
Exemple #2
0
        /// <summary>
        /// Searches the objects in the "data" parameter for in an instance of the specified sourceType
        /// and, if found, attempts to retrieve the value of the specified Property.
        /// </summary>
        /// <param name="value">Return value</param>
        /// <param name="cache">Unused</param>
        /// <param name="source">Unused</param>
        /// <param name="eventType">Unused</param>
        /// <param name="id">Unused</param>
        /// <param name="formatOrMessage">Unused</param>
        /// <param name="data">Data to be searched</param>
        /// <returns>False if no match found, true otherwise</returns>
        public override bool TryGetValue(out object value, TraceEventCache cache, string source,
                                         TraceEventType eventType, int id, string formatOrMessage, object[] data)
        {
            value = null;

            if (null == data)
            {
                return(false);
            }

            foreach (object obj in data)
            {
                PropertyResult result = _fastPropertyGetter.GetValue(obj);
                if (result.ObjectMatched)
                {
                    value = result.Data;
                    return(result.ObjectMatched);
                }
            }

            return(false);
        }