コード例 #1
0
 public CustomSerializer(Type type, string packformatName, uint version, MethodInfo methodInfo,
                         CustomSerializerCreationReason creationReason = CustomSerializerCreationReason.Explicit)
     : base(type, packformatName, version)
 {
     _methodInfo     = methodInfo;
     _creationReason = creationReason;
 }
コード例 #2
0
        public CustomDeserializer(string packformatName, uint version, MethodBase methodInfo,
                                  CustomSerializerCreationReason creationReason = CustomSerializerCreationReason.Explicit, Type targetType = null)
            : base(packformatName, version)
        {
            if (creationReason == CustomSerializerCreationReason.ImplicitByBaseType && targetType == null)
            {
                throw new ArgumentNullException("targetType", "If the creation reason is ImplicitByBaseType then targetType cannot be null.");
            }

            if (creationReason == CustomSerializerCreationReason.Explicit && targetType != null)
            {
                throw new ArgumentException("If the creation reason is Explicit then targetType should not be specified.", "targetType");
            }

            _methodInfo     = methodInfo;
            _creationReason = creationReason;
            _targetType     = targetType;
        }