In the following code below, why do the two string.Format
calls not behave the same way? In the first one, no exception is thrown, but in the second one an Ar
The first call gets resolved as a call to Format(object), while the second gets resolved as a call to Format(object[]). Null parameters are handled differently by these different overloads.
Overload resolution is described here. The relevant part is that for the second call to Format, an overload of Format(params object[]) gets expanded to Format(object[]), which is preferred to Format(object). The literal null is both an object[] and an object, but object[] is more specific, so that is chosen.