Enum misses generic methods - by Jan Kučera

Status : 


Sign in
to vote
ID 293587 Comments
Status Active Workarounds
Type Suggestion Repros 2
Opened 8/16/2007 3:02:07 AM
Access Restriction Public


Hello, we had got a very powerfull generic methods for working with arrays, lists and so on, but no single one for enums.
Sign in to post a comment.
Posted by Jan Kučera on 12/31/2009 at 9:12 AM
Seems I no longer can edit the feedback, so I'm adding one method here:

T ToObject<T>(long) or its equivalent, likely better named.
Posted by Jan Kučera on 12/31/2009 at 9:07 AM
piers1: enum type constraint is completely different request, and likely much more complex, if possible at all.

The above methods shouldn't be that difficult. Are there any news for 4.0?
Posted by Daniel Smith on 7/26/2009 at 1:45 PM
Has this been addressed in .NET 4.0?
Posted by spongman on 3/24/2009 at 11:39 AM
please add enum type constraint to C#
Posted by Cabbit on 5/13/2008 at 4:40 AM
I've been following the issues with Enum. While the rest of the framework has moved forwards Enum has stayed rooted in the past. The inclusion of generic methods for Enum would be a good thing. There are a few odd usecases where you want to be able to check if a generic parameter is an enum. Since we have "struct" and "class" generic constraints an "enum" constraint would make sense.
Posted by Microsoft on 1/11/2008 at 2:32 PM
We're considering this for the release after .NET 3.5.

Justin Van Patten
Posted by Jan Kučera on 1/11/2008 at 3:56 AM
reopening as I can't find these in .NET 3.5

Posted by Microsoft on 8/28/2007 at 11:29 AM
Thanks for the feature request!

We're considering adding generic overloads to System.Enum for the next release of the .NET Framework after .NET 3.5.

Justin Van Patten
CLR Program Manager