what is the diference between casting and converting?

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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Can datetime be null c#?

484


What is unrecognized escape sequence in c#?

507


What do you mean by streamreader/streamwriter class in c#?

522


Does c# support c type macros?

553


Can dictionary have duplicate keys c#?

495






What is namespace give the example?

460


What is trim in c#?

537


What is method and function in c#?

494


What’s thread.sleep() in threading ?

505


What is ulong in c#?

569


What is global namespace in c#?

482


What are the Configuration files in .net?

511


Is .net and c# the same?

554


What is static and use of it?

467


What is the difference between a private assembly and a shared assembly?

551