1
Vote

Review: ExtendedSource API

description

In particular, are the two methods ProfileMethod(object data) and ProfileMethod(params object[] data) ambiguous?
 
Which one will be invoked if I pass an array of objects?
 
object[] objs = new object[10];
ProfileMethod(objs);
 
What about an array of ints?

comments

sgryphon wrote Jun 3, 2009 at 3:31 PM

Not ambiguous (at least not to the compiler). The array of objects will call the params version.

You can force it to call the object version by casting to object, i.e. ProfileMethod((object)objs). An array of ints will call the object method.

wrote Feb 14, 2013 at 1:48 AM