Go to home page mail me! RSS Feed
FoxMetrics Web Analytics

Converting a negative number to a positive number

Friday, January 16, 2009 8:53 PM

The .Net Framework is swamped with a ton of code and at any given time I'm only using a few and one of the namespaces that I don't usually visit often is the System.Math namespace. If you are a game developer, you probably saying, what??? Well, that's because most of the time I'm simply pulling and putting numbers in a database, I really spend most of my time doing web development. Anyway, here is a quick and easy function to convert a negative number such as -5 to a positive number 5. I saw someone cast it to string, remove the negative symbol and cast it to an int, yuke!

 

Math.Abs(-5)

Your Comments.

  • # ;

    Gravatar;

    Left by ; at 3/4/2009 9:16 AM

Your Reply.

Comment Form.

Fields denoted with a "*" are required.

You may also like to leave your email or website.

 
Please add 3 and 8 and type the answer here:

Preview Your Comment.

 
Next entries »