c# - Difference between typecasting and parsing? -


What is the biggest difference between parsing and typcasting? I try to use typing in the string and it gives me an error.

Something like this:

  string str = "10"; Int i = (int) str; Type casting should be compatible to work type:  

object str = 10; Int i = (int) str;

Parsing is the conversion between different types:

  string str = "10"; Int i = int.Parse (str);  

Comments