title: c# Is it possible to use Extensions Methods to implement Implicit conversions?
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/685156/c-implicit-operator-and-extension-methods">C#: implicit operator and extension methods</a>  </p>
  </blockquote>
  
  
  
  <p>I have a common library project defining a number of types (nothing too complex, just properties mainly).  Two projects are referencing this common library: a client application and a webservice.</p>
  
  <p>My intention is for the webservice to return type T, then use T in the client application.  Normally I'd have to convert the type returned by the webservice to T again (because of the proxy class, T is returned as WebService.T), but I'm hoping to use <a href="http://msdn.microsoft.com/en-us/library/z5z9kes2.aspx" rel="nofollow noreferrer">implicit conversion</a> instead.</p>
  
  <p>As the original Common class has no knowledge of the web service proxy class, I'm wondering if I could make use of <a href="http://msdn.microsoft.com/en-us/library/bb383977.aspx" rel="nofollow noreferrer">extension methods </a> to implement the implicit conversion.  Sort of something like </p>
  
  <pre><code>public static implicit operator MyObject(this MyProxyObject value)
      {
          //stuff
      }
  </code></pre>
  
  <p>which the compiler doesn't like at all.</p>
  
  <p>Is something like this even possible?</p>
  
  <p><strong>Update</strong></p>
  
  <p>Ok, first off I had the 2.0 framework referenced so that explains my compiler problems.</p>
  
  <p>Secondly, I'm able to achieve the conversion by creating a method extension "ToModel" (or something).  So in terms of the business objective, I will be able to easily convert my types by calling WebService.T.ToModel().</p>
  
  <p>Though I doubt this could be done using implicit conversion (or whether its worth the trouble).</p>