title: F# Discriminated Union usage from C#
body: <p>What are the best ways to use F# Discriminated Unions from C#?</p>
  
  <p>I have been digging into this problem for a while, I have probably found the simplest way, but as it is rather complex, there may be some other thing I don't see...</p>
  
  <p>Having a discriminated union, e.g.:</p>
  
  <pre class="lang-ml prettyprint-override"><code>type Shape =
      | Rectangle of float * float
      | Circle of float
  </code></pre>
  
  <p>the usage from C# I found would be (avoiding using vars, to make the type obvious):</p>
  
  <pre><code>Shape circle = Shape.NewCircle(5.0);
  if (circle.IsCircle)
  {
      Shape.Circle c = (Shape.Circle)circle;
      double radius = c.Item;
  }
  </code></pre>
  
  <p>In C#, the <code>NewXXXX</code> static methods always create object of the <code>Shape</code> class, there is also a method <code>IsXXXX</code> to check if the object is of the type; if and only if yes, it is castable to the <code>Shape.XXXX</code> class, and only then its items are accessible; constructor of the <code>Shape.XXXX</code> classes are internal, i.e. unaccessible.</p>
  
  <p>Is anyone aware of a simpler option to get the data from a discriminated union?</p>