[Solved] Where should I call a print function for Non-compatible type conversion in C#.NET? [closed]


I don’t think your question has anything to do with printing to the console and everything to do with should you use Parse or Convert. Assuming that’s correct then you may find the following breakdown of Convert, Parse, & TryParse applicable. If it’s not correct, clarify and I’ll either edit my answer or delete as applicable.

Parse Takes a string and (assuming it is a number) outputs the number equivalent of it. It will throw an exception if the value is null, not a number, or outside the min/max range of Int.

Convert.ToInt32 Takes a string and (assuming it is a number) checks if it’s null. If null it returns 0 otherwise it calls Parse.

TryParse Takes a string and if it’s not a number returns false. If it is a number it’ll return true. If it’s null, it will return 0 in the out parameter (but return false as it’s primary return value). If it is a number, it’ll return the number as an out parameter.

4

solved Where should I call a print function for Non-compatible type conversion in C#.NET? [closed]