title: Cannot implicitly cast IEnumerable
body: <p>I have a class that indicates if a call to a method was successful (with a value) or has an error.</p>
  <pre class="lang-cs prettyprint-override"><code>internal sealed class ValueOrError&lt;TValue&gt;
  {
      public bool IsError =&gt; _error is not null;
      public bool IsSuccess =&gt; !IsError;
  
      private TValue? _value;
      private Error? _error;
  
      private ValueOrError() { }
  
      public TValue? Value =&gt;
          _error is null
          ? _value
          : throw new InvalidOperationException(&quot;Is an error type&quot;);
  
      public Error Error =&gt; _error ?? throw new InvalidOperationException(&quot;Not an error type&quot;);
  
      public static ValueOrError&lt;TValue&gt; FromValue(TValue? result) =&gt;
          new ValueOrError&lt;TValue&gt; { _value = result };
  
      public static ValueOrError&lt;TValue&gt; FromError(Error error) =&gt;
          new ValueOrError&lt;TValue&gt; { _error = error ?? throw new ArgumentNullException(nameof(error)) };
  
      public static implicit operator ValueOrError&lt;TValue&gt;(TValue value) =&gt; ValueOrError&lt;TValue&gt;.FromValue(value);
      public static implicit operator ValueOrError&lt;TValue&gt;(Error error) =&gt; ValueOrError&lt;TValue&gt;.FromError(error);
  }
  </code></pre>
  <p>I can cast implicitly just fine unless <code>TValue</code> is an <code>IEnumerable&lt;T&gt;</code>.</p>
  <pre class="lang-cs prettyprint-override"><code>// Works
  ValueOrError&lt;int&gt; x = 1;
  // Fails
  ValueOrError&lt;IEnumerable&lt;int&gt;&gt; y = Enumerable.Empty&lt;int&gt;();
  </code></pre>
  <p>Cannot implicitly convert type 'System.Collections.Generic.IEnumerable' to 'AppLayer.ValueOrError'</p>
  <p>However, I can create a result of that type &quot;the long way&quot;</p>
  <p><code>c# // Works ValueOrError&lt;IEnumerable&lt;int&gt;&gt;.FromValue(Enumerable.Empty&lt;int&gt;()); </code></p>
  <p>In case it is useful, the source for <code>Error</code> is</p>
  <pre class="lang-cs prettyprint-override"><code>public class Error
  {
      public string Message { get; }
  
      [JsonConstructor]
      public Error(string message)
      {
          Message = message ?? throw new ArgumentNullException(nameof(message));
      }
  }
  </code></pre>