Is it possible to add a string read from the console to enum as its new element during run-time in C #?

    1 answer 1

    No, it is impossible to modify types in runtime (i.e., for example, add fields, methods, etc. to types). But you can create new types using classes from System.Reflection.Emit . In particular, you can use EnumBuilder to create an enumeration. But, unfortunately, such types cannot replace already existing ones.

    In your case, I would consider using Dictionary instead of enumeration.