Sign in to follow this  

[.net] BinaryFormatter causing "0.0000" to be stored as "0"

This topic is 4046 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm writing a DataTable to disk that stores decimal values as "0.0000" in the database with 4 leading zeroes. I then write it to disk with a BinaryFormatter but when the data is written to the XML file, the value is "0" instead of "0.0000". How can I force the BinaryFormatter to keep the trailing zeros?

Share this post


Link to post
Share on other sites
Uh, wait, what? A binary formatter doesn't write XML, it writes binary. Do you mean .Net's decimal by 'a decimal type', in which case 0.0000 is 0?

Try reading the data back and seeing if it's correct. The string representation of a number in an out-of-program storage file is not important.

Share this post


Link to post
Share on other sites

This topic is 4046 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this