public void AddIterCreatorName(MethodBuilder methodBuilder, string name) { Type[] paramTypes = new Type[] { typeof(string) }; ConstructorInfo constructor = typeof(IterCreatorNameAttribute).GetConstructor(paramTypes); CustomAttributeBuilder attrBuilder = new CustomAttributeBuilder(constructor, new object[] { name }); methodBuilder.SetCustomAttribute(attrBuilder); Attribute attr = new IterCreatorNameAttribute(name); AddCustomAttribute(methodBuilder, attr); }