public static TF AddField <TF>( this SPFieldCollection fields, SPFieldType fieldType, string internalName, string displayName, string groupName, bool required, Action <TF> action) where TF : SPField { return(fields.AddField <TF>(fieldType, internalName, required, field => { field.Title = displayName; if (!string.IsNullOrEmpty(groupName)) { field.Group = groupName; } if (action != null) { action(field); } })); }