So say I've got a method which I've overloaded. One takes a function returning uints, one takes a function returning ints.
static void test1(Func<uint> f)
{
//things
}
static void test1(Func<int> f)
{
// also things
}
Now I try to call it like this:
test1(Random.FunctionThatReturnsUints);
but I get an ambiguous call error at compile time:
Error 4 The call is ambiguous between the following methods or
properties: 'RNG_Comparison.Run.test1(System.Func<int>)' and 'RNG_Comparison.Run.test1
(System.Func<uint>)'
What's up with that? Isn't the whole point of overloading a function for it to understand implicitly which one you mean based on the types? I mean, if I'd called it with a func returning BigInt or something, maybe I could see the compiler's confusion, but this one seems pretty cut and dried.
Does anyone know why I'm getting that error?