예제 #1
0
        protected internal override void UnpackToCore(MsgPack.Unpacker unpacker, MsgPack.Serialization.ListValueType <int> collection)
        {
            if ((unpacker.IsArrayHeader == false))
            {
                throw MsgPack.Serialization.SerializationExceptions.NewIsNotArrayHeader();
            }
            int count = default(int);

            count = MsgPack.Serialization.UnpackHelpers.GetItemsCount(unpacker);
            for (int i = 0; (i < count); i = (i + 1))
            {
                System.Nullable <int> nullable = default(System.Nullable <int>);
                nullable = MsgPack.Serialization.UnpackHelpers.UnpackNullableInt32Value(unpacker, typeof(MsgPack.Serialization.ListValueType <int>), string.Format(System.Globalization.CultureInfo.InvariantCulture, "item{0}", new object[] {
                    ((object)(i))
                }));
                if (nullable.HasValue)
                {
                    collection.Add(nullable.Value);
                }
                else
                {
                    throw MsgPack.Serialization.SerializationExceptions.NewValueTypeCannotBeNull(string.Format(System.Globalization.CultureInfo.InvariantCulture, "item{0}", new object[] {
                        ((object)(i))
                    }), typeof(int), typeof(MsgPack.Serialization.ListValueType <int>));
                }
            }
        }
예제 #2
0
 protected internal override MsgPack.Serialization.ListValueType <int> UnpackFromCore(MsgPack.Unpacker unpacker)
 {
     if ((unpacker.IsArrayHeader == false))
     {
         throw MsgPack.Serialization.SerializationExceptions.NewIsNotArrayHeader();
     }
     MsgPack.Serialization.ListValueType <int> collection = default(MsgPack.Serialization.ListValueType <int>);
     collection = new MsgPack.Serialization.ListValueType <int>(MsgPack.Serialization.UnpackHelpers.GetItemsCount(unpacker));
     this.UnpackToCore(unpacker, collection);
     return(collection);
 }
예제 #3
0
        protected internal override void PackToCore(MsgPack.Packer packer, MsgPack.Serialization.ListValueType <int> objectTree)
        {
            packer.PackArrayHeader(objectTree.Count);
            System.Collections.Generic.IEnumerator <int> enumerator = objectTree.GetEnumerator();
            int current;

            try {
                for (
                    ; enumerator.MoveNext();
                    )
                {
                    current = enumerator.Current;
                    this._serializer0.PackTo(packer, current);
                }
            }
            finally {
                enumerator.Dispose();
            }
        }
예제 #4
0
 protected override MsgPack.Serialization.ListValueType <int> CreateInstance(int initialCapacity)
 {
     MsgPack.Serialization.ListValueType <int> collection = default(MsgPack.Serialization.ListValueType <int>);
     collection = new MsgPack.Serialization.ListValueType <int>(initialCapacity);
     return(collection);
 }