I have not tried lambdas without parameters, but usually you just need to declare a variable in advance:
var client = MySvcRef.MySvcClient();
var assistant = FormsAuthenticationAssistant();
var totalRecords;
var result = assistant.Execute<MySvcRef.UserClass[]>(
()=>client.GetAllUsers(out totalRecords, pageIndex, pageSize),
client.InnerChannel);
Edit
It’s best to conclude GetAllUserswith a separate class that can use a parameter out:
Temp temp = new Temp();
var result = assistant.Execute<MySvcRef.UserClass[]>(()=>temp.GetAllUsers(client, pageIndex, pageSize),client.InnerChannel);
int totalRecords = temp.TotalRecords;
...
class Temp
{
public int TotalRecords;
public MySvcRef.UserClass[] GetAllUsers(MySvcClient client, int pageIndex, int pageSize)
{
int totalRecords;
var result = client.GetAllUsers(out totalRecords, pageIndex, pageSize);
TotalRecords = totalRecords;
return result;
}
}
source
share