Is the params keyword really not supported within extension methods?
I have found that when I create extension methods with the params keyword, that I get "No overloaded method for X takes 2 arguments". Intellisense recognizes the extension method and even knows that it needs an object array.
Here's some sample code:
public static DalRow EasyRetrieveSingle(this DalRow dalRow, object[] parameters)
{
Dictionary<string, object> dic = new Dictionary<string, object>();
for (int i = 0; i < parameters.Length; i += 2)
dic.Add(parameters[i].ToString(), parameters[i + 1]);
List<DalRow> list = DalRow.RetrieveByFieldValues(dalRow.Structure, null, dic).Cast<DalRow>().ToList();
if (list.Count == 0) return null;
return list[0];
}
Here's some sample code that calls it (to no avail)
(new X()).EasyRetrieveSingle(1, 2);