Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Not sequential enums via web services

Status
Not open for further replies.

SBGibson

Programmer
Apr 18, 2001
125
IT
Hi guys,

you know if there's some problem passing a not sequential enum via web services?
I noticed that a
public enum myenum {
firstelement=1,
secondelement=10,
finalelement=15
end enum

become in the reference on the client
public enum myenum {
firstelement,
secondelement,
finalelement
end enum

That is wrong cause if I pass myenum.secondelement I receive an error saying that "10 is not a valid element for myenum"

Stevie B. Gibson
 
Try defining your enum with a Flags Attribute:
Code:
<FlagsAttribute()>
Public Enum myenum {
   firstelement=1,
   secondelement=10,
   finalelement=15
End Enum
Chip H.


____________________________________________________________________
If you want to get the best response to a question, please read FAQ222-2244 first
 
BTW, you know this is the C# forum, and you posted VB.NET code?

In C# it would be:
Code:
[FlagsAttribute]
Enum myenum {
   firstelement=1,
   secondelement=10,
   finalelement=15
};
Chip H.


____________________________________________________________________
If you want to get the best response to a question, please read FAQ222-2244 first
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top