/// <summary>
        /// Initializes a new instance of the <see cref="CilGenericField"/> class.
        /// </summary>
        /// <param name="module">The module.</param>
        /// <param name="genericField">The generic field.</param>
        /// <param name="signature">The signature.</param>
        /// <param name="declaringType">Type of the declaring.</param>
        public CilGenericField(ITypeModule module, RuntimeField genericField, FieldSignature signature, CilGenericType declaringType)
            : base(module, declaringType)
        {
            this.Signature = signature;
            this.Attributes = genericField.Attributes;
            //TODO
            //this.SetAttributes(genericField.CustomAttributes);

            base.Name = genericField.Name;
        }
        public void ResolveInterfaces(ITypeModule typeModule)
        {
            foreach (RuntimeType type in baseGenericType.Interfaces)
            {
                if (!type.ContainsOpenGenericParameters)
                {
                    Interfaces.Add(type);
                }
                else
                {
                    CilGenericType genericType = type as CilGenericType;
                    Debug.Assert(genericType != null);

                    RuntimeType matchedInterfaceType = null;

                    // -- only needs to search generic type interfaces
                    foreach (RuntimeType runtimetype in typeModule.GetAllTypes())
                    {
                        if (runtimetype.IsInterface)
                        {
                            CilGenericType runtimetypegeneric = runtimetype as CilGenericType;
                            if (runtimetypegeneric != null)
                            {
                                if (genericType.baseGenericType == runtimetypegeneric.baseGenericType)
                                {
                                    if (SigType.Equals(GenericArguments, runtimetypegeneric.GenericArguments))
                                    {
                                        matchedInterfaceType = runtimetype;
                                        //Interfaces.Add(runtimetype);
                                        break;
                                    }
                                }
                            }
                        }
                    }

                    if (matchedInterfaceType != null)
                    {
                        Interfaces.Add(matchedInterfaceType);
                    }
                    else
                    {
                        continue;
                    }
                }
            }
        }
Beispiel #3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="CilGenericField"/> class.
        /// </summary>
        /// <param name="module">The module.</param>
        /// <param name="genericField">The generic field.</param>
        /// <param name="signature">The signature.</param>
        /// <param name="declaringType">Type of the declaring.</param>
        public CilGenericField(ITypeModule module, RuntimeField genericField, FieldSignature signature, CilGenericType declaringType) :
            base(module, declaringType)
        {
            this.Signature  = signature;
            this.Attributes = genericField.Attributes;
            //TODO
            //this.SetAttributes(genericField.CustomAttributes);

            base.Name = genericField.Name;
        }