Skip to content

Covariance generic arguments don't work with Enums? #9342

Answered by HaloFour
justinbhopper asked this question in Q&A
Discussion options

You must be logged in to vote

Generic variance doesn't work with value types. While System.Enum itself is technically a reference type, every implementation of an enum is a value type and has the same layout as the underlying integral type.

Replies: 2 comments 3 replies

Comment options

You must be logged in to vote
2 replies
@justinbhopper
Comment options

@333fred
Comment options

Answer selected by justinbhopper
Comment options

You must be logged in to vote
1 reply
@TahirAhmadov
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants