Named parameters with params

A params argument works like an array, try this syntax:

var userInfo1 = Unit.UserSrvc.GetValues(include: new Expression<Func<TEntity, object>>[] { p => p.Membership, p => p.User });

(Might need some adapting due to the generic parameter, but I think you get the gist of it)


I think the only way is something like:

GetValues(include:
   new Expression<Func<TEntity, object>>[] { p => p.Membership, p => p.User })

Which is not that great. It would be probably best if you added an overload for that:

public List<Entity> GetValues(params Expression<Func<Entity, object>>[] include)
{
    return GetValues(null, null, null, include);
}

Then you call your method just like

GetValues(p => p.Membership, p => p.User)