CSI.Utils.Dumpl C# (CSharp) Method

Dumpl() public static method

public static Dumpl ( IEnumerable c ) : void
c IEnumerable
return void
        public static void Dumpl(IEnumerable c)
        {
            Write("{");
            int nlines = 0;
            StringBuilder sb = new StringBuilder();
            int screenWidth = GetLineWidth();
            int maxLines = GetMaxLines() - 1;
            bool isFirstItem = true;
            foreach (object o in c)
            {
                if (isFirstItem)
                {
                    isFirstItem = false;
                }
                else
                {
                    sb.Append(',');
                }
                string s;
                if (o != null)
                {
                    s = o.ToString();
                    if (o is string) s = "\"" + s + "\"";
                    else
                        if (o is char) s = "\'" + s + "\'";
                }
                else
                    s = "<null>";
                if (sb.Length + s.Length >= screenWidth)
                {
                    if (sb.Length > 0)
                    {
                        Write(sb.ToString());
                        Write("\n");
                        sb.Length = 0;
                    }
                    if (++nlines > maxLines)
                    {
                        sb.Append(".....");
                        break;
                    }
                }
                sb.Append(s);
            }
            Write(sb.ToString() + "}\n");
        }