Possible Duplicate:
Ambiguous call between two C# extension generic methods one where T:class and other where T:struct
I've this two functions :
public static Degrees Convert<TInput>(this TInput input)
where TInput : NumericValue, IDegreesBased, new()
{
//Some stuff
}
public static SquarredMeters Convert<TInput>(this TInput input)
where TInput : NumericValue, ISquarredMetersBased, new()
{
// Some stuff
}
When I call new SquarredKilometers(10).Convert(), there is an error saying that the call is ambiguous between the two functions above. The SquarredKilometers class implements the ISquarredMetersBased interface.
EDIT : So it seems to be normal. Any workaround for this precise problem ? (Interface implementation)
Constraints are not part of the method signature, so the methods have identical parameter types. Eric Lippert always explains C# the best: http://blogs.msdn.com/b/ericlippert/archive/2009/12/10/constraints-are-not-part-of-the-signature.aspx
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With