title: Sharing Enum with WCF Service
body: <p>I have few different applications among which I'd like to share a C# enum. I can't quite figure out how to share an enum declaration between a regular application and a WCF service. </p>
  
  <p>Here's the situation. I have 2 lightweight C# destop apps and a WCF webservice that all need to share enum values. </p>
  
  <p>Client 1 has   </p>
  
  <pre><code> Method1( MyEnum e, string sUserId );
  </code></pre>
  
  <p>Client 2 has   </p>
  
  <pre><code>Method2( MyEnum e, string sUserId );
  </code></pre>
  
  <p>Webservice has   </p>
  
  <pre><code>ServiceMethod1( MyEnum e, string sUserId, string sSomeData);
  </code></pre>
  
  <p>My initial though was to create a library called Common.dll to encapsulate the enum and then just reference that library in all of the projects where the enum is needed. However, WCF makes things difficult because you need to markup the enum for it to be an integral part of the service. Like this:  </p>
  
  <pre><code>[ServiceContract]
  [ServiceKnownType(typeof(MyEnum))]
  public interface IMyService
  {
      [OperationContract]
      ServiceMethod1( MyEnum e, string sUserId, string sSomeData);
  }
  
  [DataContract]
  public enum MyEnum{ [EnumMember] red, [EnumMember] green, [EnumMember] blue };  
  </code></pre>
  
  <p>So .... Is there a way to share an enum among a WCF service and other applictions? </p>