How can I use a enum in a datacontract WCF

I want to have an enum in a datacontract of a WCF webservice.

I am trying using

class myclass
    public int id {get; set;}

    public enum myenum

But I am not able to access enum at the wcf client. Please let me know what I am doing wrong.


To be included in the mex/wsdl, the enum needs to be used somewhere in the graph, for example there should be a property somewhere of type myenum. Types not actively used in the graph are omitted.

Note also that you don't actually need to annotate enums at all - they will work just fine. You only need attributes on enums if you want to customize how they act on the wire.

As Marc said - use it. The datatype itself is not an issue until it is required iirc.

Part from that its not required to have Datacontract and EnumMember on it (special rules apply). See for more information.

Need Your Help

How can I compare two files in emacs, similar to vim's vimdiff?

vim emacs diff

If I do a diff from emacs, I get something that looks like a patch, and the files are concatenated in one big file. Is there any function that I could use to compare them like in this image? It's m...