WCF and Enum

I have a data contract on the server that looks like:

/// SKU types for party items.
[DataContract()]
public enum SkuTypeEnum
{
[EnumMember()]
NotSpecified,
[EnumMember()]
Other,
[EnumMember()]
Component,
[EnumMember()]
Party,
}

But when I run svcutil and get a client proxy for the call this type shows up as a string. Is there any way that I can see the enum on the client?

Thank you.

Kevin

[486 byte] By [KevinBurton] at [2008-1-5]
# 1
Hi Kevin,
there is no need to apply the DataContract attribute on the Enum type. Enum is always serializable. For your question, there is no way to do it but you can rewrite your proxy client and use the enum as in your service.

HTH

FabioCozzolino at 2007-10-3 > top of Msdn Tech,Visual Studio Orcas,Windows Communication Foundation (Indigo)...
# 2
If you're writing both the client and the server, why use a proxy class at all? I put common types like the above in a separate assembly that is shared by both the client and the server, along with the interface for my service and referece these directly (instead of generating proxies).

Otherwise about the only thing I can suggest is using the Enum.Parse method.

Jimmy

JimmytheDev at 2007-10-3 > top of Msdn Tech,Visual Studio Orcas,Windows Communication Foundation (Indigo)...

Visual Studio Orcas

Site Classified