예제 #1
0
 public void AddRange(GenericParameterCollection value)
 {
     for (int i = 0; i < value.Count; i++)
     {
         List.Add(value[i]);
     }
 }
 public static Collection <GenericParameter> GetGenericParameters(
     IGenericParameterProvider self,
     ref Collection <GenericParameter> collection,
     ModuleDefinition module)
 {
     return(Mixin.HasImage(module)
         ? module.Read(ref collection, self, (provider, reader) => reader.ReadGenericParameters(provider))
         : collection = new GenericParameterCollection(self));
 }
		public static Collection<GenericParameter> GetGenericParameters (
			this IGenericParameterProvider self,
			ref Collection<GenericParameter> collection,
			ModuleDefinition module)
		{
			return module.HasImage ()
				? module.Read (ref collection, self, (provider, reader) => reader.ReadGenericParameters (provider))
				: collection = new GenericParameterCollection (self);
		}
예제 #4
0
 public static Collection <GenericParameter> GetGenericParameters(
     this IGenericParameterProvider self,
     /*Telerik Authorship*/ ref Collection <GenericParameter> collection,
     ModuleDefinition module)
 {
     /*Telerik Authorship*/
     return(module.HasImage()
                         ? module.Read(ref collection, self, (provider, reader) => reader.ReadGenericParameters(provider))
                         : collection = new GenericParameterCollection(self));
 }
예제 #5
0
 public static Collection <GenericParameter> GetGenericParameters(this IGenericParameterProvider self, ref Collection <GenericParameter> collection, ModuleDefinition module)
 {
     if (!module.HasImage())
     {
         Collection <GenericParameter> collection2;
         collection = collection2 = new GenericParameterCollection(self);
         return(collection2);
     }
     return(module.Read <IGenericParameterProvider, Collection <GenericParameter> >(ref collection, self, (provider, reader) => reader.ReadGenericParameters(provider)));
 }
        public override void VisitGenericParameterCollection(GenericParameterCollection genparams)
        {

        }
예제 #7
0
 public virtual void VisitGenericParameterCollection(GenericParameterCollection genparams)
 {
 }
예제 #8
0
        public override void VisitGenericParameterCollection(GenericParameterCollection parameters)
        {
            if (parameters.Count == 0)
                return;

            foreach (GenericParameter gp in parameters)
                m_genericParamStack.Add (gp);
        }
 public virtual void VisitGenericParameterCollection(GenericParameterCollection genparams)
 {
     foreach (GenericParameter param in genparams)
     {
         VisitGenericParameter(param);
     }
 }
        public virtual void VisitGenericParameterCollection(GenericParameterCollection genparams)
        {

        }
 public void AddRange(GenericParameterCollection value)
 {
     for (int i = 0; i < value.Count; i++)
         List.Add(value[i]);
 }
        private void InitializeGenericParameters(DefineGenericParametersDelegate defineGenericParameters,
            GenericParameterCollection genericParameters)
        {
            if (genericParameters.Count == 0)
                return;

            string[] names = CollectionUtils.ConvertAllToArray<GenericParameter, string>(genericParameters, delegate(GenericParameter genericParameter)
            {
                return genericParameter.Name;
            });

            GenericTypeParameterBuilder[] genericTypeParameterBuilders = defineGenericParameters(names);

            for (int i = 0; i < genericParameters.Count; i++)
            {
                GenericTypeParameterBuilder genericTypeParameterBuilder = genericTypeParameterBuilders[i];
                GenericParameter genericParameter = genericParameters[i];

                genericTypeParameterBuilder.SetGenericParameterAttributes(
                    (System.Reflection.GenericParameterAttributes) genericParameter.Attributes);

                if (genericParameter.Constraints.Count != 0)
                {
                    Type classConstraint = null;
                    List<Type> interfaceConstraints = new List<Type>();

                    foreach (TypeReference typeReference in genericParameter.Constraints)
                    {
                        Type type = ResolveType(typeReference);
                        if (type.IsInterface)
                            interfaceConstraints.Add(type);
                        else
                            classConstraint = type;
                    }

                    if (classConstraint != null)
                        genericTypeParameterBuilder.SetBaseTypeConstraint(classConstraint);
                    if (interfaceConstraints.Count != 0)
                        genericTypeParameterBuilder.SetInterfaceConstraints(interfaceConstraints.ToArray());
                }
            }

            metadataPass.Add(delegate
            {
                for (int i = 0; i < genericParameters.Count; i++)
                {
                    InitializeCustomAttributes(genericTypeParameterBuilders[i].SetCustomAttribute,
                        genericParameters[i].CustomAttributes);
                }
            });
        }
예제 #13
0
    public static List<string> ExamineGenericParameters(GenericParameterCollection genericParameters, TypeReference declaringType, out List<MyGenericParameterInfo> myGenericParameters, bool returnAllGenericParametersNames)
    {
      Debug.Assert(genericParameters != null && genericParameters.Count > 0, "Impossible!");

      myGenericParameters = new List<MyGenericParameterInfo>();

      int startIndex = declaringType != null ? declaringType.GenericParameters.Count : 0;

      for (int i = startIndex; i < genericParameters.Count; i++)
      {
        myGenericParameters.Add(new MyGenericParameterInfo(genericParameters[i]));
      }

      if (returnAllGenericParametersNames)
      {
        List<string> allGenericParametersNames = null;

        if (genericParameters.Count > 0)
        {
          allGenericParametersNames = new List<string>();

          for (int i = 0; i < genericParameters.Count; i++)
          {
            allGenericParametersNames.Add(genericParameters[i].Name);
          }
        }

        return allGenericParametersNames;
      }

      return null;
    }
예제 #14
0
 public static List<string> ExamineGenericParameters(GenericParameterCollection genericParameters, TypeReference declaringType, out List<MyGenericParameterInfo> myGenericParameters)
 {
   return ExamineGenericParameters(genericParameters, declaringType, out myGenericParameters, false);
 }
예제 #15
0
 private void Visit(GenericParameterCollection genericParameterCollection)
 {
   foreach (GenericParameter parameter in genericParameterCollection)
   {
     foreach (TypeReference reference in parameter.Constraints)
     {
       _modelCreator.UseType(reference.ToTypeKey());
     }
     _modelCreator.UseType(parameter.ToTypeKey());
   }
 }