예제 #1
0
        private void WriteList(XTJsonList jlist)
        {
            this.m_tw.Write("[");
            int index = 0;
            int count = jlist.Count;

            foreach (XTJsonData jdata in jlist)
            {
                index += 1;
                this.WriteJsonData(jdata);
                if (index < count)
                {
                    this.m_tw.Write(", ");
                }
            }
            this.m_tw.Write("]");
        }
예제 #2
0
        public static long[] AsLongs(this XTJsonData jdata)
        {
            if (jdata.Type == XTJsonType.None)
            {
                return(null);
            }
            XTJsonList jlist = jdata as XTJsonList;

            if (jlist == null)
            {
                throw new XTJsonTypeConvertException(jdata.Type, typeof(long[]));
            }
            long[] items = new long[jlist.Count];
            int    index = -1;

            foreach (XTJsonData item in (XTJsonList)jdata)
            {
                try { items[++index] = (long)item; }
                catch { throw new XTJsonTypeConvertException(jdata.Type, typeof(long[])); }
            }
            return(items);
        }