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
Explain how do I convert a string to an int in c#?
What is class sortedlist underneath?
What is an assembly in dotnet?
What is a method signature?
What are jagged arrays used for?
What is Co- and Contra-Variance in C#?
what is difference between destruct or and garbage collection ?
What is a cshtml file?
When was c# created?
What is difference between private and static constructor?
How many types of variables are there in c#?
Is arraylist type safe in c#?
How to parse a date time string?
What is parameterized constructor?
What is anonymous types in c#?