title: How do I cast from Nullable<T> explicitly
body: <p>i have defined custom value type MyCustomValueType with implicit cast operator from long to MyCustomValueType.</p>
  
  <pre><code>public struct MyCustomValueType
  {
      private readonly long number;
  
      public MyCustomValueType(long? number)
      {
          this.number = number.GetValueOrDefault(0);
      }
  
      public static implicit operator MyCustomValueType(long number)
      {
          return new MyCustomValueType(number);
      }
  }
  </code></pre>
  
  <p>Then the compiler allows me to do the following:</p>
  
  <pre><code>// ...
  long? value = null;
  MyCustomValueType myCustomValueType = (MyCustomValueType)value;
  Console.WriteLine(myCustomValueType);
  </code></pre>
  
  <p>Under the hood, the compiler translates the statement with casting into:</p>
  
  <pre><code>MyCustomValueType myCustomValueType = ((long?)null).Value;
  </code></pre>
  
  <p>I would like to know how (or better said WHY) is this happening? Why does the compiler even allow explicit casting no one is defined. What rules does the compiler apply here? </p>
  
  <hr>
  
  <p>I should probably also mention that such casting is also possible when MyCustomValueType defines only explicit operator for casting, such as:</p>
  
  <pre><code>public static explicit operator MyCustomValueType(long number)
  </code></pre>
  
  <p>But in this case I somehow accept what compiler does and understand it. The case with the implicit operator is really confusing. Can someone please explain it?</p>