Setting enum values in a web service

T

Tom Jones

I am attempting to consume a web service with an enum parameter and not sure
how to set a value for it. It looks as follows:

[System.CodeDom.Compiler.GeneratedCodeAttribute("svcutil",
"3.0.4506.30")]
[System.SerializableAttribute()]
[System.Xml.Serialization.XmlTypeAttribute(Namespace="http://myserver/mystuff")]
public enum SrcTypeEnum
{
WEB,
MAINFRAME,
WEB
}

How do I set this value? For example:

WS.SrcType = "WEB" does not complile, whereas WS.SrcType = new SrcTypeEnum()
compiles fine but is worthless for setting the value.
 
G

Guest

Not exactly sure what you are doing here, but WS.SrcType="WEB" will certainly
not compile, because WS.SrcType is an enum, not a string. Normally we would
use an enum like so:
WSSrcType.WEB
Peter
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top