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


Please Help Members By Posting Answers For Below Questions

What is data types in c#?

519


How many classes are there in classification?

507


Is boxing an implicit conversion?

537


What is difference between Enum and Struct?

550


Can a class have multiple constructors c#?

496






Why dictionary is faster than list?

553


What is the purpose of namespace?

465


Which function is the entry point for a DLL in MS Windows 3.1?

680


what is collections in .net? why we use?

1684


Tell me the difference between value passing and address passing?

624


What is a helper method in c#?

475


What are interfaces in c#?

512


Why is c# a good programming language?

471


How main method is called in c#?

512


What is a thread c#?

489