I am looking to return the following class through a web service, which includes an enum type as one of its members.
[Serializable, XmlRoot("GeoCoordinate")]
public class GeoCoordinate
{
public enum AccuracyLevel
{
Unknown = 0,
Country = 1,
Region = 2,
SubRegion = 3,
Town = 4,
PostalCode = 5,
Street = 6,
Intersection = 7,
Address = 8,
Premise = 9
}
private AccuracyLevel _accuracy;
// ... more members
public AccuracyLevel Accuracy
{
get { return _accuracy; }
set { _accuracy = value;}
}
}
This works correctly, but will return a result in the form of:
<!-- ... -->
<Accuracy>Unknown or Country or Region or SubRegion or Town or
PostalCode or Street or Intersection or Address or Premise</Accuracy>
<!-- ... -->
Instead of a string that represents the enum, I would like it to simply return an integer. Can this be done without changing the type of GeoCoordinate.Accuracy
?