コード例 #1
0
        /// <summary>
        /// Adds all object fields as entries in generated toString.
        /// </summary>
        /// <param name="includeBase">Should include base class properties, default: False</param>
        /// <returns>this</returns>
        public ToStringHelper AddFields(bool includeBase = false)
        {
            var fields = Reflections.Fields(type, includeBase);

            foreach (var key in fields.OrderedKeys)
            {
                Add(key, fields.GetIfPresent(key));
            }
            return(this);
        }
コード例 #2
0
        /// <summary>
        /// Adds all object properties as entries in generated toString.
        /// </summary>
        /// <param name="includeBase">Should include base class properties, default: False</param>
        /// <returns>this</returns>
        public ToStringHelper AddProperties(bool includeBase = false)
        {
            var properties = Reflections.Properties(type, includeBase);

            foreach (var key in properties.OrderedKeys)
            {
                Add(key, properties.GetIfPresent(key));
            }
            return(this);
        }