A Sharp Delineation between Char and ANSIString

 

Overview

Some computer programmers confront data conversions in the algorithms they create on an infrequent basis, but for most of us these conversions are the bane of our existence. In the past, the programmers who suffered the most were those who wrote financial programs. They performed all their mathematics in floating point (base 2 arithmetic), then converted the answers to base 10 arithmetic formats when it came time to print the results or display them on the screen.

Then the Visual Studio C# architects decided to include in their compiler the mathematics that most of us practice all our lives ” decimal arithmetic (base 10). How sweet it is! Since there are now two arithmetic systems using decimal points (float and decimal), you will notice that numbers entered in Visual Studio C# algorithms often contain an f or an m at the end of the number to inform the compiler which type of data is present (float or decimal). The decision to use m as a decimal arithmetic identifier is especially appropriate since money begins with an m. But decimal number does not mean that the number always includes precisely two digits to the right of the decimal point ” there can be as many as eight digits after the decimal point.

Here are some definitions that may be helpful in the conversion process.

Parse: A method to transfer data from a string into other, non-string data types (integer, float, double, etc.).

Convert: A method to convert data from non-string types primarily (but converts from string types occasionally).

Int16: A short.

Int32: An int.

Int64: A long.

 


Unlocking Microsoft C# V 2.0 Programming Secrets
Unlocking Microsoft C# V 2.0 Programming Secrets (Wordware Applications Library)
ISBN: 1556220979
EAN: 2147483647
Year: 2005
Pages: 129

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net