public IGenericTypeParameterBuilder[] DefineGenericParameters(string[] names) { ArgumentUtility.CheckNotNull("names", names); return(_methodBuilder .DefineGenericParameters(names) .Select(b => new GenericTypeParameterBuilderDecorator(b, EmittableOperandProvider)).Cast <IGenericTypeParameterBuilder>().ToArray()); }
private void DefineGenericParameters(CodeGenerationContext context, IMethodBuilder methodBuilder, MutableMethodInfo method) { if (!method.IsGenericMethodDefinition) { return; } var genericParameterNames = method.MutableGenericParameters.Select(p => p.Name).ToArray(); var genericParametersBuilders = methodBuilder.DefineGenericParameters(genericParameterNames); foreach (var pair in genericParametersBuilders.Zip(method.MutableGenericParameters, (b, g) => new { Builder = b, GenericParameter = g })) { pair.Builder.RegisterWith(context.EmittableOperandProvider, pair.GenericParameter); DefineGenericParameter(pair.Builder, pair.GenericParameter); } }