Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 65063
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T18:53:16+00:00 2026-05-10T18:53:16+00:00

I have few different applications among which I’d like to share a C# enum.

  • 0

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.

Here’s the situation. I have 2 lightweight C# destop apps and a WCF webservice that all need to share enum values.

Client 1 has

 Method1( MyEnum e, string sUserId ); 

Client 2 has

Method2( MyEnum e, string sUserId ); 

Webservice has

ServiceMethod1( MyEnum e, string sUserId, string sSomeData); 

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:

[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 };   

So …. Is there a way to share an enum among a WCF service and other applictions?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-10T18:53:16+00:00Added an answer on May 10, 2026 at 6:53 pm

    Using the Common library should be fine. Enumerations are serializable and the DataContract attributes are not needed.

    See: http://msdn.microsoft.com/en-us/library/ms731923.aspx

    Enumeration types. Enumerations, including flag enumerations, are serializable. Optionally, enumeration types can be marked with the DataContractAttribute attribute, in which case every member that participates in serialization must be marked with the EnumMemberAttribute attribute

    EDIT: Even so, there should be no issue with having the enum marked as a DataContract and having client libraries using it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 121k
  • Answers 121k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer I usually try to explain it to my clients in… May 12, 2026 at 12:21 am
  • Editorial Team
    Editorial Team added an answer If I understand your idea you select all records in… May 12, 2026 at 12:21 am
  • Editorial Team
    Editorial Team added an answer WordPress with e-Commerce plugin seems to be a simple and… May 12, 2026 at 12:21 am

Related Questions

I have few different applications among which I'd like to share a C# enum.
I have an application (an IP conferencing service) that I need to scale. It
I've been pulling my hear out over this problem for a few hours yesterday:
I have one ASP.NET web application running at the web server root which provides
NOTE I have asked the related question: How to combine DataTrigger and EventTrigger? I

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.