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 does get set mean in c#?
Which of the following operations can you not perform on an ado.net dataset?
What is a Command Object in C#?
Why do we use struct in c#?
Explain the process of polymorphism with an example?
What is a deadlock lock?
What is use of abstract class in c#?
What is a data set in c#?
What is the difference between wrapper class and primitive?
What is parse method in c#?
Explain how to parse a datetime string?
Can we make a Static Constructor Parameterized? Give Reason with your answer
Can I define my own exceptions?
Why is static constructor called first?
Why dependency injection is used in c#?