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)