Exemplo n.º 1
0
 /// <summary>
 ///		Creates serializer as <typeparamref name="TObject"/> is map type.
 /// </summary>
 /// <returns>
 ///		<see cref="MessagePackSerializer{T}"/>.
 ///		This value will not be <c>null</c>.
 /// </returns>
 public sealed override MessagePackSerializer <TObject> CreateMapSerializer()
 {
     using (var emitter = EmittingSerializerBuilderLogics.CreateMapSerializerCore(this.Context, typeof(TObject), this._emitterFlavor))
     {
         try
         {
             return(emitter.CreateInstance <TObject>(this.Context));
         }
         finally
         {
             emitter.FlushTrace();
         }
     }
 }
        public sealed override MessagePackSerializer <TObject> CreateMapSerializer()
        {
            MessagePackSerializer <TObject> serializer;

            using (SerializerEmitter emitter = EmittingSerializerBuilderLogics.CreateMapSerializerCore(typeof(TObject), this._emitterFlavor))
            {
                try
                {
                    serializer = emitter.CreateInstance <TObject>(base.Context);
                }
                finally
                {
                    emitter.FlushTrace();
                }
            }
            return(serializer);
        }
Exemplo n.º 3
0
        /// <summary>
        ///		Creates serializer as <typeparamref name="TObject"/> is tuple type.
        /// </summary>
        /// <returns>
        ///		<see cref="MessagePackSerializer{T}"/>.
        ///		This value will not be <c>null</c>.
        /// </returns>
        public sealed override MessagePackSerializer <TObject> CreateTupleSerializer()
        {
#if WINDOWS_PHONE || NETFX_35
            throw new PlatformNotSupportedException();
#else
            using (var emitter = EmittingSerializerBuilderLogics.CreateTupleSerializerCore(typeof(TObject), this._emitterFlavor))
            {
                try
                {
                    return(emitter.CreateInstance <TObject>(this.Context));
                }
                finally
                {
                    emitter.FlushTrace();
                }
            }
#endif
        }