❔ Could someone please clarify the difference between Explicit Casting and Converting?
From what I've read, they seem to serve the same function, taking a value of one type and changing it to another type, and the only difference is that explicit casting has the potential to lose accuracy. Examples shown in attached pics.
So in what scenarios would you want to use cast / convert over the other?
Thanks
5 Replies
can't really do a better explanation than this
Stack Overflow
Difference between casting and using the Convert.To() method
I have a function that casts a double on string values.
string variable = "5.00";
double varDouble = (double)variable;
A code change was checked in and the project builds with the error: System.
feel free to skip to the "Conclusions" section
Ok, thank you for that I will check it out
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.