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