I have system A which makes a request to a Soap web service hosted on system B. Currently system B returns a decimal data type which is formatted to show 3 decimal places. I used the wsdl.exe tool to generate classes and it just shows as a straight decimal.
I need to replicate system B with my own Soap service but I can't get the decimal field to show 3 decimal places. I have no control over what system A is expecting and i am told that it must show decimals even if the value is round (eg 500.000).
After reading lots of posts about formatting to strings then decimal parsing, nothing I do can force this behavior. I have looked at Soap and XML attributes but nothing can seem to control this.
How can I achieve this?
Embarrassingly it works!
if (_fd.CreditLimit.HasValue) {
decimal _dd = Convert.ToDecimal(_fd.CreditLimit.Value.ToString("#.000"));
//decimal _dd = 500.000m;
_rv.CreditLimit = _dd;
}
I was breaking my code in Visual Studio and when i inspected the variable _dd it was showing 500. However if i let Soap do its thing and return the result it shows 500.000 as the value.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.