N
not_a_commie
I have an Angle class that I store angles in. It's basically just a
bunch of fancy functions for manipulating a double. It has implicit
casts for converting to/from double. Due to the project structure and
where it stores the preferred SI units for display, I wanted to have
the TypeConverter in a different project that has no reference to the
angle class. However, returning a double from the ConvertFrom function
throws an error that it can't convert from "System.Double" to my Angle
type. Originally, before the SI units where unaccessable, I had this
in there:
double angle;
...
if (context.PropertyDescriptor.PropertyType.Equals(typeof(Angle)))
return new Angle(angle);
return angle;
Can I do something similar even if I don't have a reference to the
Angle type? Why would it not accept my implicit cast to double?
bunch of fancy functions for manipulating a double. It has implicit
casts for converting to/from double. Due to the project structure and
where it stores the preferred SI units for display, I wanted to have
the TypeConverter in a different project that has no reference to the
angle class. However, returning a double from the ConvertFrom function
throws an error that it can't convert from "System.Double" to my Angle
type. Originally, before the SI units where unaccessable, I had this
in there:
double angle;
...
if (context.PropertyDescriptor.PropertyType.Equals(typeof(Angle)))
return new Angle(angle);
return angle;
Can I do something similar even if I don't have a reference to the
Angle type? Why would it not accept my implicit cast to double?