The InvalidCastException occurs if the wrong data type is used, if there is a data mismatch
If you enter a number within the integer range the program executes as it should
The correct data type to store a string in is a string
The correct data type to store a number in is an integer
You can store a number in a string variable as long as you declare it as a string and are not using it for any mathematical reasons
No comments:
Post a Comment