> Out of curiosity, is there a rule in C# that says it always chooses the most specific method when using overloads
I think there might be, at least that's what C# does. And F# does it as well - in these examples, the distinction works correctly. In the C# class:
public void Reply2(string arg1, ref int arg2) {
Console.WriteLine( "statically typed version");
}
public void Reply2<T>(string arg1, ref T arg2) {
Console.WriteLine( "generic version");
}
public void Reply3(int arg1, ref int arg2) {
Console.WriteLine("statically typed version");
}
public void Reply3<T>(T arg1, ref T arg2) {
Console.WriteLine("generic version");
}
And in F#:
let aval = 10
testclass.Reply2("blah", ref aval)
testclass.Reply3(10, ref aval);
Both of these result in the output "statically typed version".
I have no idea in which significant way the other example is different from those working cases.