我希望通过web服务返回以下类,其中包含枚举类型作为其成员之一。
这个功能运行正确,但将返回以下格式的结果:
[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;}
}
}
这个功能运行正确,但将返回以下格式的结果:
<!-- ... -->
<Accuracy>Unknown or Country or Region or SubRegion or Town or
PostalCode or Street or Intersection or Address or Premise</Accuracy>
<!-- ... -->
我希望它只返回一个整数,而不是表示枚举的字符串。在不改变 GeoCoordinate.Accuracy
类型的情况下,能否实现这一点?