Skip to content

Instantly share code, notes, and snippets.

@Vannevelj
Created January 13, 2016 14:40
Show Gist options
  • Save Vannevelj/e196db696d3be107a660 to your computer and use it in GitHub Desktop.
Save Vannevelj/e196db696d3be107a660 to your computer and use it in GitHub Desktop.
public static IList<Obj> SelectListFor<T>()
{
Type enumType = typeof(T);
if (enumType.IsEnum)
{
return Enum.GetValues(enumType)
.Cast<int>()
.Where(i => !i.Equals(0))
.Select(e => new Obj()
{
Value = e.ToString(),
Text = "test"
})
.ToList();
}
return null;
}
public class Obj
{
public string Value;
public string Text;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment