C# enum deconstruction and assosiated data
hi, I want to follow the book crafting interpreters and I don't want to use the exact languadge he uses (java) to avoid copy pasting code without understanding it, I am looking at maybe using C# (I know... super far away from java), however I can't find a feature Ill prob want to use,
is there a way to do rust style enum types with associated data?
think something like (super super psudo code)
5 Replies
create a custom class probably
enum are limited in c#
I see, would I have to make the class with a slot for each and fill it with nulls where I don't have data? or how would I go about it
You can sorta hack it
there is a nuget package to have java like enum in c#
let me find that
https://github.com/ardalis/SmartEnum
That would work, ty 🙂