c# - Include values with function delegate? -
this isn't doing, close enough. have 2 delegates pointing same function.
var foo=new func<string, string, dynamic, string>(f); var bar=new func<string, string, dynamic, string>(f);
foo called group of threads (not 1 thread). bar called different group of threads.
one of parameters function needs know group of threads called from.
i can make each thread when invokes function tell group name (the threads know group belong to), there way pass thread group name (a string) function when declaring foo , bar ?
so anytime thread calls foo, function f know called first group, , everytime thread calls bar, function f know called second group ?
you mean this?
var foo = new func<string, dynamic, string>((s,d) => f("123", s, d)); var bar = new func<string, dynamic, string>((s,d) => f("456", s, d));
that way constant used once during declaration of delegates.