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 WC
I must have had some issues with an outdated service reference or something. I went back and created a common library containing the enum, and everything works fine. I simply added a using reference to the service interface's file.
using Common;
[ServiceContract]
[ServiceKnownType(typeof(MyEnum))]
public interface IMyService
{
[OperationContract]
ServiceMethod1( MyEnum e, string sUserId, string sSomeData);
}
and I dropped the following:
[DataContract]
public enum MyEnum{ [EnumMember] red, [EnumMember] green, [EnumMember] blue };
I guess since the enum is referenced via ServiceKnownType, it didn't need to be marked up in the external library with [DataContract] or [Enumerator]