Here on this page, Scott Hanselman shows two examples from Micro-ORMs Dapper and Massive, and the Massive example drew me to this because I don’t see how they can implement this syntax.
An example is the following, where I am going to split it into several lines instead of one long one:
var tbl = new Products(); var products = tbl.All(where: "CategoryID = @0 AND UnitPrice > @1", orderBy: "ProductName", limit: 20, args: 5,20); ^----+---^ | +-- this
How did they implement this syntax, allowing args have multiple values? I accept params arguments because this is the only thing that allows it, but I don’t understand how they built the method to allow this, because it seems to me that everything I try ends up complaining about names, arguments and fixed position arguments are in wrong order.
I tried a test method:
public static void Test(string name, int age, params object[] args) { }
and then using named arguments:
Test(age: 40, name: "Lasse", args: 10, 25);
But all I get is:
Named arguments must appear after all fixed arguments have been defined.
so it’s obvious that it’s wrong. In addition, I do not see anything in the source that would allow this, but maybe I'm looking in the wrong place.
What am I missing here?