c# - How can I use System.Func? -


i have trouble using system.func.

public func<int> oncreated=new func<int>(int asd){ debug.log (asd); }; 

is proper way use it? want make dynamic function can called. can system.func serialized via xml?

maybe you're looking action<> instead?

action<int> myaction = myintparam => debug.log(myintparam); myaction(myinteger); 

if want take input parameter, , return something, should use func<>

func<int, int> myfunc = myintparam => {    debug.log(myintparam);    return 5; }; int 5 = myfunc(myinteger); 

also, if want serialize/deserialize, need take 1 step further. namely, def func not have meaningful information serialized, should wrap in expression. can started googling "c# serialize expression", eg: https://expressiontree.codeplex.com


Comments

Popular posts from this blog

node.js - How to mock a third-party api calls in the backend -

node.js - Why do I get "SOCKS connection failed. Connection not allowed by ruleset" for some .onion sites? -

matlab - 0-by-1 sym - What do I need to change in order to get proper symbolic results? -