CK.Monitoring.ParentedLogEntry.DoGetPath C# (CSharp) Method

DoGetPath() private method

private DoGetPath ( Action collector ) : void
collector Action
return void
        void DoGetPath( Action<ParentedLogEntry> collector )
        {
            if( Parent != null ) Parent.DoGetPath( collector );
            collector( this );
        }
    }

Usage Example

Esempio n. 1
0
        /// <summary>
        /// Collects the path of this <see cref="ParentedLogEntry"/>, optionally terminated with this entry.
        /// </summary>
        /// <param name="collector">Action for each item.</param>
        /// <param name="addThis">Set it to true to append to also call the collector with this entry.</param>
        public void CollectPath(Action <ParentedLogEntry> collector, bool addThis = false)
        {
            if (collector == null)
            {
                throw new ArgumentNullException("collector");
            }

            if (Parent != null)
            {
                Parent.DoGetPath(collector);
            }
            if (addThis)
            {
                collector(this);
            }
        }