Extension methods cannot overload any method defined for their target type, simply because they are not members of the target type. Extension methods do not add anything to their target types. It is simply compiler magic that allows them to be called as if they were methods defined in their target type. In fact, they are defined in a separate static type, so they cannot overload any method in their target type.
Behind the scenes, the compiler replaces any calls to your extension method with an Extensions call.
It looks like you are trying to make C # behave like Ruby and initialize an array of objects by passing a set of values ββor at least mimicking the behavior of dictionary initialization. Unfortunately, you cannot do this without overloading List <>.
Initializing a collection is another bit of compiler magic that tries to find the Add method with as many arguments as there are elements in the argument list. If it were otherwise, you could define a conversion operator to convert the list to your Tuple type.
Why don't you just use the built-in object initializers? You just need to write a little more code
source share