Union property "Tag" => enum #936
StefanBertels
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
IMO union property Tag should be changed to enum.
compare:
#681 (comment)
I just have a need of getting the type name of the union value and while I can use this.GetType().Name I think it would be cleaner to use this.Tag.ToString().
This would have more advantages like getting compiler warnings when using this enum as int (e.g. comparing Tag values of different union types) or avoiding a number in serialization (reordering code lines might break serialization).
I think this enum would have members with names identical to the individual typenames (including same case) which means using a clear qualifier (enum type name) would be a good thing.
Beta Was this translation helpful? Give feedback.
All reactions