Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


what is the diference between casting and converting?

Answers were Sorted based on User's Feedback



what is the diference between casting and converting?..

Answer / kiran vaidya

When you use Convert class, you have some predefined types
which are defined by .Net framework such as Convert.ToInt32
or Convert.ToString and so on. That means you can convert
whatever you want to only system defined types.

while in casting, you can have your own choices to convert
data. i.e. user defined types.

for eg. you have a class called Employee and you want to
convert some object to Employee, then the best way to do
this is casting.

Is This Answer Correct ?    10 Yes 0 No

what is the diference between casting and converting?..

Answer / 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

More C Sharp Interview Questions

What is stringreader in c#?

0 Answers  


What is mvc in c#?

0 Answers  


if we inherit class in stack so object of stack will store in stack or heap? as class a { int s; public aa(){} } stack mystack:a { } mystack obj; ans: about obj

1 Answers  


How do you generate documentation from the C# file commented properly with a command-line compiler?

1 Answers  


What is ControlBox Propertie

0 Answers   MCN Solutions,


Ho we can see assembly information?

0 Answers  


Name the control which cannot be placed in mdi?

0 Answers  


What is generic in c#?

0 Answers  


What is the difference between const and static read-only?

0 Answers  


What is the difference between mobile application and desktop application?

0 Answers  


What is list array in c#?

0 Answers  


Is string a primitive data type in c#?

0 Answers  


Categories