c# - understand the following lambda -
i have method like
void test(func<bool> f) { f.invoke(); }
i pass in test( ()=>getitem("123") )
f.invoke()
called getitem("123")
.
i want know how f
know getitem
has parameter?
what passing test
parameter-less delegate
calls getitem
method. test
method not know parameters getitem
. knows delegate
calling.
test( ()=>getitem("123") )
is equal to
test(delegate { return getitem("abc") ; } );
which calling
test(mymethod) ... bool mymethod() { return getitem("123"); }
Comments
Post a Comment