Jump to content
  • Advertisement
Sign in to follow this  
soconne

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

This topic is 4262 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
Advertisement
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
Guest Anonymous Poster
Try adding .0000 to it ;)

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!