Beispiel #1
0
        /*
         *      Get string representation from individual element.
         *      If type E is unknown then return null, otherwise return element's string representation.
         */
        private static string getString <E>(ref E element)
        {
            ToStringable tos = element as ToStringable;

            // non-fatal error, as element that is array, we need to avoid endless loop in calling
            if (tos == null)
            {
                return(null);
            }

            return(tos.toString());
        }
Beispiel #2
0
        /// <summary>Build string representation of object</summary>
        /// <param name="obj">Object to get string representation</param>
        /// <returns>string</returns>
        public static string build(ToStringable obj)
        {
            string s = "{";

            if (obj != null)
            {
                s += obj.toString();
            }

            s += "}";
            return(s);
        }