leekelleher/uComponents — pull request #1 by tomfulton (2013-12-13 22:37:35+00:00)
Title: Enum Helper Methods

This is for workitem [14779](http://ucomponents.codeplex.com/workitem/14779)

This extracts the code used by `EnumCheckBoxList` and `EnumDropDownList` into a helper method so that others can easily reuse the values specified in the Enum's custom attributes. For example, if you want to output the values on the website front-end.

I chose to return `ListItem` since the properties in the attribute already match perfectly - might need to be changed in the future, though, if properties are added.

I'll update the documentation with these new methods once they're finalized.

## Syntax ##

### Razor / C# ###
```
var enumListItems = uComponents.Core.EnumHelper.GetEnumListAttributeValues(typeof (SiteColour));

foreach (var listItem in enumListItems)
{

@listItem.Text

}
```

### XSLT ###
```

```

## Issues ##
- [ ] `uComponents.Core` probably isn't the best place for this. Ideally it would live in the `DataTypes` project, but I couldn't find a good place to put it since it applies to both the `EnumCheckBoxList` and `EnumDropDownList` datatypes.
- [ ] Better method name than `GetEnumListAttributeValues` ? :grimacing: