c# - Func and lambda question -


i have declaration of

void test (func<bool> f) 

i have method bool getitem(string id)

i can call test ( ()=>getitem("123")), why?

i suppose can check need 1 string parameter.

func<bool> expects function returns bool. func<t1> has 1 output argument, func<t1, t2> takes function input t1 , output t2. each successive version allows additional input argument, final generic type being type of output argument.

ex.: func<string, string, bool> able invoke bool dostuff(string s1, string s2)

quick edit clarify: test( () => getitem("123")) works because start of lambda declaration exposes no input arguments, , getitem returns boolean.


Comments

Popular posts from this blog

android - Spacing between the stars of a rating bar? -

aspxgridview - Devexpress grid - header filter does not work if column is initially hidden -

c# - How to execute a particular part of code asynchronously in a class -