what is the diference between casting and converting?
Answer Posted / praveen
The Convert.ToInt32(String, IFormatProvider) underneath
calls the Int32.Parse. So the only difference is that if a
null string is passed to Convert it returns 0, whereas
Int32.Parse throws an ArgumentNullException.
It is really a matter of choice whichever you use.
Also have a look at the new .NET 2.0 method Int32.TryParse,
which attempts to convert a string to an int without
throwing an exception.
Is This Answer Correct ? | 8 Yes | 0 No |
Post New Answer View All Answers
What is data types in c#?
How many classes are there in classification?
Is boxing an implicit conversion?
What is difference between Enum and Struct?
Can a class have multiple constructors c#?
Why dictionary is faster than list?
What is the purpose of namespace?
Which function is the entry point for a DLL in MS Windows 3.1?
what is collections in .net? why we use?
Tell me the difference between value passing and address passing?
What is a helper method in c#?
What are interfaces in c#?
Why is c# a good programming language?
How main method is called in c#?
What is a thread c#?