If I have the following simple class:
[Serializable]
public class Test
{
public double a = 0.0000001;
}
When I return an object of this type from a .NET ASMX Web Service, the response will be:
<Test>
<a>1E-07</a>
</Test>
which is, perhaps not coincidentally, the default behavior of 0.0000001.ToString()
, though at least with ToString
, I can specify the formatting parameters (in this case, I do not want exponential notation. In truth, I'm not even sure how I would hook this into an XmlSerializer
I had complete control over it, much less just from within the attributes I could place on the return object.
Edit: I'd still very much like to keep the property in what I'm actually applying this to strongly-typed. Both 0.0000001 and 1E-7 are valid double representations in .NET, I just want to have it send things across the wire as the other one.