c# - Dynamically specifying lambda function parameters -


suppose have following line of code:

context.load(itemcollection, item => item.include(i => i["title"], => i["name"])); 

is there way can dynamically specify parameters item.include() function instead of hard-coding them above?

i ideally allow users select properties want retrieve of object such title, name, description, etc.

fyi, here clientcontext.load function. function coming microsoft.sharepoint.client.dll

public void load<t>(t clientobject, params expression<func<t, object>>[] retrievals) t : clientobject {   if ((object) clientobject == null)     throw new argumentnullexception("clientobject");   clientaction.checkactionparameterincontext(this, (object) clientobject);   dataretrieval.load<t>(clientobject, retrievals); } 

i don't have necessary setup test it, work?

string[] keys = ...; context.load(   itemcollection               , item => item                         .include(keys                         .select(key => { => i[key] })                         .toarray()             ); 

Comments

Popular posts from this blog

c++ - llvm function pass ReplaceInstWithInst malloc -

java.lang.NoClassDefFoundError When Creating New Android Project -

Decoding a Python 2 `tempfile` with python-future -