title: What is the best way to implement a Rust enum in C#?
body: <p>I have an entity that can be in one of different states (StateA, StateB and StateC), and in each of them have relevant data of distinct types (TStateA, TStateB, TStateC). <a href="https://doc.rust-lang.org/book/enums.html" rel="noreferrer">Enums in Rust represent this perfectly</a>. What is the best way to implement something like this in C#?</p>
  
  <p><a href="https://stackoverflow.com/questions/126781/c-union-in-c-sharp">This question may appear similar</a>, but enums in Rust and unions in C are significantly different.</p>