C# Lambda Return Statement Question -
hey all, quick question on how call lambda or does..
public composite createbuffcheckandcast(string name, unitselectdelegate onunit, canrundecoratordelegate extra) { return new decorator( ret => spells.canbuff(name, onunit(ret)) && extra(ret), new action(ret => spells.buff(name, onunit(ret)))); } unfortunately don't have rest of class , haven't used lambdas in while.. "ret" variable come from? calling function? used grab ienumerable see compiler assigning whatever type onunit accept..?
solution:
ret => used transform spells.canbuff delegate type accepted decorator. onunit accept delegate function parameter.
the ret variable parameter delegate (or expression tree) lambda expression building. note ret first lambda expression different ret 1 in second lambda expression.
so, 2 delegates created, , passed decorator constructor, presumably stores them execute them later on. when each delegate called, caller have pass value in available ret parameter during lambda expression's execution.
without seeing signature of decorator constructor is, it's hard more that.
i'm not quite sure relevance of second snippet of code is, i'm afraid.
Comments
Post a Comment