Passing null as one of the arguments
suggest changeIf you have
void F1(MyType1 x) {
// do something
}
void F1(MyType2 x) {
// do something else
}
and for some reason you need to call the first overload of F1
but with x = null
, then doing simply
F1(null);
will not compile as the call is ambiguous. To counter this you can do
F1(null as MyType1);
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents