2012年9月5日 星期三

difference between Casting and Parsing


Casting is changing the type of the variable.
Parsing is 'examining' the string and assigning its logical value to some variable.


http://social.msdn.microsoft.com/forums/en-US/csharpgeneral/thread/57518616-a142-4e89-99c9-e2fa6b01ef6f

What is the difference bewtween x.ToString() and (String) x?
x.ToString() will try to call ToString() on the object x.
(String) x will try to cast x to string, and will fail if x isn't string.


沒有留言:

張貼留言