Setting enum values in a web service

  • Thread starter Thread starter Tom Jones
  • Start date Start date
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.
 
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
 
Back
Top