Sign in to follow this  
soconne

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

Recommended Posts

soconne    105
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
Bob Janova    769
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

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