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 IComparable
How long does a loop recorder procedure take?
What is the difference between serialization and deserialization in c#?
Should I make my destructor virtual?
Give an example to show for hiding base class methods?
Should I use double or float?
Is arraylist faster than linkedlist?
What is the difference between hashtable and dictionary in c#?
Explain what is an interface in c#?
What does private void mean in c#?
What is argument in c#?
What is reference c#?
Explain About a class access specifiers and method access specifiers.
What is primitive types in c#?
What is the implicit name of the parameter that gets passed into the set method/property of a class?