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 virtual method in c#?
What is multicast delegate explain with example?
What is a linked list c#?
Does c# have its own class library?
What are c# i/o classes?
What is the difference between yield and return?
How you will create satellite assemblies?
What are generations and how are they used by the garbage collector?
Can structs in c# have destructors?
How do I unload an assembly?
What is the difference between system.text.stringbuilder and system.string?
Can I use exceptions in c#?
Why data types are important in c#?
Why do we use struct in c#?
What are custom exceptions? Why do we need them?