NewTypeCannotSerialize() 공개 정적인 메소드

This is intended to MsgPack for CLI internal use. Do not use this type from application directly. Returns new exception to notify that value type cannot serialize.
public static NewTypeCannotSerialize ( Type type ) : Exception
type System.Type The target type.
리턴 System.Exception
        /// <summary>
        ///		Initializes a new instance of the <see cref="AutoMessagePackSerializer&lt;T&gt;"/> class.
        /// </summary>
        public AutoMessagePackSerializer(SerializationContext context, Func <SerializationContext, SerializerBuilder <T> > builderProvider)
            : base(context.CompatibilityOptions.PackerCompatibilityOptions)
        {
            Contract.Assert(context != null);

            var serializer = context.Serializers.Get <T>(context);

            if (serializer != null)
            {
                this._underlying = serializer;
                return;
            }

            var traits = typeof(T).GetCollectionTraits();

            switch (traits.CollectionType)
            {
            case CollectionKind.Array:
            {
                serializer = builderProvider(context).CreateArraySerializer();
                break;
            }

            case CollectionKind.Map:
            {
                serializer = builderProvider(context).CreateMapSerializer();
                break;
            }

            case CollectionKind.NotCollection:
            {
                if ((typeof(T).GetAssembly().Equals(typeof(object).GetAssembly()) || typeof(T).GetAssembly().Equals(typeof(Enumerable).GetAssembly())) &&
                    typeof(T).GetIsPublic() && typeof(T).Name.StartsWith("Tuple`", StringComparison.Ordinal))
                {
                    serializer = builderProvider(context).CreateTupleSerializer();
                }
                else
                {
                    serializer = builderProvider(context).CreateSerializer();
                }
                break;
            }
            }

            if (serializer != null)
            {
                if (!context.Serializers.Register <T>(serializer))
                {
                    serializer = context.Serializers.Get <T>(context);
                    Contract.Assert(serializer != null);
                }

                this._underlying = serializer;
                return;
            }

            throw SerializationExceptions.NewTypeCannotSerialize(typeof(T));
        }
        /// <summary>
        ///		Initializes a new instance of the <see cref="AutoMessagePackSerializer&lt;T&gt;"/> class.
        /// </summary>
        public AutoMessagePackSerializer(Type type, SerializationContext context, Func <SerializationContext, ISerializerBuilder> builderProvider)
            : base(type, context.CompatibilityOptions.PackerCompatibilityOptions)
        {
            Contract.Assert(context != null);

            var serializer = context.Serializers.Get(type, context);

            if (serializer != null)
            {
                this._underlying = serializer;
                return;
            }

            var traits = type.GetCollectionTraits();

            switch (traits.CollectionType)
            {
            case CollectionKind.Array:
            {
                serializer = builderProvider(context).CreateArraySerializer();
                break;
            }

            case CollectionKind.Map:
            {
                serializer = builderProvider(context).CreateMapSerializer();
                break;
            }

            case CollectionKind.NotCollection:
            {
                serializer = builderProvider(context).CreateSerializer();

                break;
            }
            }

            if (serializer != null)
            {
                if (!context.Serializers.Register(type, serializer))
                {
                    serializer = context.Serializers.Get(type, context);
                    Contract.Assert(serializer != null);
                }

                this._underlying = serializer;
                return;
            }

            throw SerializationExceptions.NewTypeCannotSerialize(type);
        }