title: Defining implicit and explicit casts for C# interfaces
body: <p>Is there a way to write interface-based code (i.e. using interfaces rather than classes as the types accepted and passed around) in C# without giving up the use of things like implicit casts? Here's some sample code - there's been a lot removed, but these are the relevant portions.</p>
  
  <pre><code> public class Game
   {
       public class VariantInfo
       {
           public string Language { get; set; }
           public string Variant { get; set; }
       }
   }
  </code></pre>
  
  <p>And in ScrDictionary.cs, we have...</p>
  
  <pre><code> public class ScrDictionary: IScrDictionary
   {
       public string Language { get; set; }
       public string Variant { get; set; }
  
       public static implicit operator Game.VariantInfo(ScrDictionary s)
       {
          return new Game.VariantInfo{Language=sd.Language, Variant=sd.Variant};
       }
   }
  </code></pre>
  
  <p>And the interface...</p>
  
  <pre><code> public interface IScrDictionary
   {
       string Language { get; set; }
       string Variant { get; set; }
   }
  </code></pre>
  
  <p>I want to be able to use <code>IScrDictionary</code> instead of <code>ScrDictionary</code>, but still be able to implicitly convert a <code>ScrDictionary</code> to a <code>Game.VariantInfo</code>. Also, while there may be an easy way to make this work by giving <code>IScrDictionary</code> a property of type <code>Game.VariantInfo</code> my question is more generally: <strong>Is there a way to define casts or operator overloading on interfaces?</strong> (If not, what is the proper C# way to maintain this functionality without giving up interface-oriented design?)</p>