NECROMAN: neco jsem nasel, to je ale pekna bejkarna :)
public static List<T> GetItemsList<T>(int enums) where T : struct, IConvertible
{
if (!typeof(T).IsEnum)
{
throw new Exception("Type given must be an Enum");
}
IEnumerable<T> allValues = Enum.GetValues(typeof (T));
return allValues
.Cast<int>()
.Where(i => (enums & i) == i)
.Select(i => (T) Enum.Parse(typeof(T), i.ToString(), true))
.ToList();
}