Reputation: 65
I want to get the minimum value from my enum list. I know I can:
return Enum.GetValues(typeof(VerloningsPeriodeType)).Cast<VerloningsPeriodeType>().Min();
however, this is only from the ENUM, and I want it from my var.
Something like:
public static ENUM_A BepaalMaxVerloningsPeriode(IEnumerable<ENUM_A> periods)
{
return Enum.GetValues(typeof(ENUM_A)).Cast<ENUM_A>().Min();
}
Where do I place the periods
var?
Upvotes: 0
Views: 3222
Reputation: 269478
You can simply call Min
on periods
itself:
public static ENUM_A BepaalMaxVerloningsPeriode(IEnumerable<ENUM_A> periods)
{
return periods.Min();
}
This makes your BepaalMaxVerloningsPeriode
method trivially simple. Your code will almost certainly be clearer if you get rid of your custom method and just call Min
directly.
Upvotes: 9