Nice post, the dialogs are hilarious.
BTW, is there any way to avoid having to unbox to the specific type besides using something parsing the object into the generic type?
For example if I know the property is numeric I can unbox it as an object and then parse the string representation into a double or decimal thus avoiding the intermediate cast. I would really like something that would actually trigger the implicit conversion on runtime
The standard approach to accomplish what you’re asking for (if I understand you correctly) is to use the System.Convert class and one of its methods based on the type you want: Convert.ToDouble, Convert.ToDecimal, etc.
Hahaha, that dramatization is wonderful. I appreciate your help with that problem immensely. Thank you!
Nice post, the dialogs are hilarious.
BTW, is there any way to avoid having to unbox to the specific type besides using something parsing the object into the generic type?
For example if I know the property is numeric I can unbox it as an object and then parse the string representation into a double or decimal thus avoiding the intermediate cast. I would really like something that would actually trigger the implicit conversion on runtime
The standard approach to accomplish what you’re asking for (if I understand you correctly) is to use the
System.Convert
class and one of its methods based on the type you want:Convert.ToDouble
,Convert.ToDecimal
, etc.Yeah, it works like a charm, thanks