Integers an strings are different beasts.
The length of a string is NOT equal to the integer the string represents. For instance, the string
"5"
has length
1
while (of course) representing the integer
5
. So the
String.Length
property and the
Int32.Parse
method serve a different purpose.
Assuming you want to implement a simple (e.g. just an adder) calculator you have to:
- Convert the string representation of the numbers to the actual integers.
- Perform the requested (and predefined) operation
- convert back the result to a string in order to produce the output to the user