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
How do you clear a list in c#?
What is callback delegate in c#?
What is a factory in c#?
Define acid rule of thumb for transactions in c#.
What is difference between write and writeline in c#?
Describe the ways of cleaning up objects in c#.
Can you put two constructor with the same structure in a class?
Which property do we set on a Combo Box to display data on it prior to setting the DataSource ?
What is void in c#?
What is collection of classes in c#?
Can a constructor be private in c#?
What is ac callback?
Does a loop recorder have to be removed?
Can we override interface method?
What is difference between private, protected, and public in C#?