title: why do my static implicit operators complain there is no body in one class and not another
body: <p>I am trying to serialize <code>MailMessage</code> objects. To do this a <code>SerializableMailMessage</code> class was implemented by a previous developer ( shown below).</p>
  
  <p>To fix some bugs I am changing from a binary <code>Iformatter</code> to a json <code>Iformatter</code>. Json has some issues with <code>NameValueCollections</code> so I needed to create a new <code>serializableMailMessage</code> to handle the conversion. </p>
  
  <p>This is where the problem crops up. If I copy and paste the below code to a fresh class, and make no changes, all of a sudden the 2 public static implicit operators start complaining that they need a body because they are not marked as abstract , extern or partial.</p>
  
  <p>If I give them a body e.g.</p>
  
  <pre><code> public static implicit operator MailMessage(SerializableMailMessage message){}; 
  </code></pre>
  
  <p>They then need a return value. The only value I could think of returning is message, but this then creates a StackOverFlowException.</p>
  
  <p>Could someone explain to me what might be going on here?
  Why is it okay for there not to be a body in the below code but not okay in an identical class? How do i get around the issue?</p>
  
  <pre><code>using System.Collections.Specialized;
  using System.Net.Mail;
  using System.Text;
  
  namespace S22.Mail
  {
      //
      // Summary:
      //     A serializable replication of the MailMessage class of the System.Net.Mail namespace.
      //     It implements conversion operators to allow for implicit conversion between SerializableMailMessage
      //     and MailMessage objects.
      public class SerializableMailMessage
      {
          public SerializableAlternateViewCollection AlternateViews { get; }
          public SerializableAttachmentCollection Attachments { get; }
          public SerializableMailAddressCollection Bcc { get; }
          public string Body { get; set; }
          public Encoding BodyEncoding { get; set; }
          public SerializableMailAddressCollection CC { get; }
          public DeliveryNotificationOptions DeliveryNotificationOptions { get; set; }
          public SerializableMailAddress From { get; set; }
          public NameValueCollection Headers { get; }
          public Encoding HeadersEncoding { get; set; }
          public bool IsBodyHtml { get; set; }
          public MailPriority Priority { get; set; }
          public SerializableMailAddress ReplyTo { get; set; }
          public SerializableMailAddressCollection ReplyToList { get; }
          public SerializableMailAddress Sender { get; set; }
          public string Subject { get; set; }
          public Encoding SubjectEncoding { get; set; }
          public SerializableMailAddressCollection To { get; }
  
          public static implicit operator SerializableMailMessage(MailMessage message);
          public static implicit operator MailMessage(SerializableMailMessage message);
      }
  }
  </code></pre>