title: Adding constructor (or function) to enum
body: <p>I am not sure if a constructor is exactly what I am looking for but if I explain what I am trying to do hopefully someone can tell me if I am trying to do is a silly idea or whether there are ways to do it.</p>
  
  <p>So I have an enum:</p>
  
  <pre><code>public enum MessageType
  {
      Normal, 
      Error, 
      Chat, 
      Groupchat, 
      Headline
  }
  </code></pre>
  
  <p>This enum is basically a wrapper for the jabber.net <code>MessageType</code>. So I want to create my enum from this. So at the moment I have a function like this:</p>
  
  <pre><code>private MessageType ConvertMessageType(JabberMessageType jabberType)
  {
      MessageType type = MessageType.Error;
  
      switch (jabberType)
      {
          case JabberMessageType.normal:
              type = MessageType.Normal;
              break;
  
          //etc
      }
  
      return type;
  }
  </code></pre>
  
  <p>So I have to use <code>enum MessageType type = ConvertMessageType(JabberMessageType.groupchat);</code></p>
  
  <p>What I would like though is to be able to do something like:</p>
  
  <pre><code>enum MessageType type = MessageType(JabberMessageType.groupchat);
  // or 
  enum MessageType type = MessageType.FromJabberJid(JabberMessageType.groupchat);
  </code></pre>
  
  <p>So that the conversion belongs with the enum rather than being a method outtside of.</p>