Created
January 13, 2016 14:40
-
-
Save Vannevelj/e196db696d3be107a660 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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