In my code using reflections i wrote
if (f.FieldType.IsAssignableFrom(\"\".GetType()))
I have a class that has an implicit conversion to st
I would use an extension method which gets all public static methods and checks for a method with the correct name and return type.
public static class TypeExtentions
{
public static bool ImplicitlyConvertsTo(this Type type, Type destinationType)
{
if (type == destinationType)
return true;
return (from method in type.GetMethods(BindingFlags.Static |
BindingFlags.Public)
where method.Name == "op_Implicit" &&
method.ReturnType == destinationType
select method
).Count() > 0;
}
}