Question: One more question from the [series](https://stackoverflow.com/questions/21403467/is-void-a-valid-return-value-for-a-function) "why does VisualStudio not support this code?"...

Given an overloaded function

```
private string ConfigQuery(string username) {
    return "A";
}
private string ConfigQuery(int configId) {
    return "B";
}

```

the following code is not possible:

```
public Config ConfigAPI(int id=0) {
    string s = ConfigQuery(id==0?User.Identity.Name:id);
}

```

but the code

```
public Config ConfigAPI(int id=0) {
    string s = (id==0?ConfigQuery(User.Identity.Name):ConfigQuery(id));
}

```

is. Is this reasonable behaviour? Then why would I use an overloaded function at all, instead of giving them more appropriate names like UserNameConfigQuery, ConfigIdConfigQuery?

Answer: 
Generally speaking, with a few exceptions such as the use of reflection, you are correct, there really isn't any "functionality" in overloading a method as opposed to creating a new method with a different name entirely. This is because, as has already been said, overload resolution is done at compile time (again, there are a few rare exceptions to this which should, generally speaking, be avoided) rather than at run time.

So you really *aren't* gaining anything, in terms of functionality, over giving each method a different name. It's mostly for convenience as a programmer, and to make it clear to users of your type that the method does the same thing, it just does it using one of several options.
Overloading is resolved at compile time, not at run time. The ternary operator `?:` is evaluated at runtime. So at compile time, compiler doesn't know which function overload to link to as it doesn't know if `id==0` or not. That's why your second example works because which overload called there can be resolved at compile time.

The reason for overloading is convenience of calling the same logical function with different number or type of parameters.