Hacker News new | ask | show | jobs
by pbowyer 1670 days ago
I'm not convinced by Enums having methods. For those of you using other languages that support this, do you find them useful?
3 comments

Enums with methods are essentially a compiler supported way of having several static readonly instances on a class with a private constructor. It’s not always useful, but it can be nice, sometimes. I’ve had a few times working with C# where I’d have liked those.
I've found a couple odd instances where it'd be nice. But also utility classes work just fine too.
Borrowed from java...