示例#1
0
        internal MonoType(MonoManager manager, MonoTypeContext context) :
            base(context.Type.Namespace, ToPrimitiveType(context.Type), MonoUtils.GetName(context.Type))
        {
            if (context.Type.ContainsGenericParameter)
            {
                throw new ArgumentException(nameof(context));
            }
            if (IsSerializableArray(context.Type))
            {
                throw new ArgumentException(nameof(context));
            }

            manager.AddSerializableType(context.Type, this);
            Base   = GetBaseType(manager, context);
            Fields = CreateFields(manager, context);
        }
示例#2
0
        internal MonoType(MonoManager manager, TypeReference type, IReadOnlyDictionary <GenericParameter, TypeReference> arguments) :
            base(type.Namespace, ToPrimitiveType(type), MonoUtils.GetName(type))
        {
            if (type.IsGenericParameter)
            {
                throw new ArgumentException(nameof(type));
            }
            if (MonoField.IsSerializableArray(type))
            {
                throw new ArgumentException(nameof(type));
            }

            string uniqueName = GetUniqueName(type);

            manager.AssemblyManager.AddSerializableType(uniqueName, this);
            Base   = GetBaseType(manager, type, arguments);
            Fields = CreateFields(manager, type, arguments);
        }