枚举和Web服务问题 [英] Problem with enum and web service
本文介绍了枚举和Web服务问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好,
我在类库中声明了一个枚举SampleType.
我已经在Web服务中添加了上述类库的dll.
该枚举是Web Service中定义的属性的返回类型.
现在,当我在控制台应用程序中使用Web服务时.
在这里,我将SampleType和SampleType1视为两个枚举.
谁能告诉我为什么会这样吗?这可能是我所想不到的非常小的事情.
谢谢,
Nagendra.
解决方案
在使用WCF平台的情况下,您可以像这样定义枚举:
[DataContract] 公共 枚举 MyEnum {[EnumMember]红色,[EnumMember]绿色,[EnumMember]蓝色}; pre>
Hi All,
I have declared an enum SampleType in class library.
I have added above class library''s dll in a Web Service.
That enum is a return type for a property defined in Web Service.
Now, when i am consuming the web service in a console application.
Here i am seeing SampleType and SampleType1 as two enums.
Can anyone tell me why this is happening? It could be a very minor thing which i am missing.
Thanks,
Nagendra.
解决方案
Hi in case of using WCF platform, you can define your enum like this:
[DataContract] public enum MyEnum{ [EnumMember] red, [EnumMember] green, [EnumMember] blue };
这篇关于枚举和Web服务问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文