Ejemplo n.º 1
0
        public void TestStringRepresentation()
        {
            var a = new uint[2];

            a[0] = 10;
            a[1] = 123;

            Assert.AreEqual("10\\123", ArrayHelperMethods.GetStringRepresentation(a));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Returns the supplied value unchanged unless it is an Array or an IDictionary in which case it will be converted into a string representation (including support
        /// for sub arrays / trees within arrays and vice versa).
        /// </summary>
        /// <param name="value"></param>
        /// <returns></returns>
        public static object Flatten(object value)
        {
            if (value is Array)
            {
                return(ArrayHelperMethods.GetStringRepresentation((Array)value).Trim());
            }

            if (value is IDictionary)
            {
                return(DictionaryHelperMethods.AsciiArt((IDictionary)value).Trim());
            }

            if (value is string)
            {
                return(((string)value).Trim());
            }

            return(value);
        }