예제 #1
0
        private static V[] ArrayCreator <V>(ListTreeNode <T> src)
        {
            if (!src.IsArray())
            {
                throw new ArgumentException("value is not array");
            }
            var count = src.GetArrayCount();

            return(new V[count]);
        }
예제 #2
0
        public static V[] GenericArrayDeserializer <V>(ListTreeNode <T> s)
        {
            if (!s.IsArray())
            {
                throw new ArgumentException("not array: " + s.Value.ValueType);
            }
            var u = new V[s.GetArrayCount()];
            var i = 0;

            foreach (var x in s.ArrayItems())
            {
                x.Deserialize(ref u[i++]);
            }
            return(u);
        }
예제 #3
0
        public static List <V> GenericListDeserializer <V>(ListTreeNode <T> s)
        {
            if (!s.IsArray())
            {
                throw new ArgumentException("not array: " + s.Value.ValueType);
            }
            var u = new List <V>(s.GetArrayCount());

            foreach (var x in s.ArrayItems())
            {
                var e = default(V);
                x.Deserialize(ref e);
                u.Add(e);
            }

            return(u);
        }