c# - Passing func inline as a parameter (eg a => a....) -


How can I provide a function for a method, so I can write something:

  Method Test (a => a.IsAltTagAvailable);  

The signature of this method takes a func, which gives an object (called HtmlImage) when the situation is complete (basically just one word).

EDIT: I need to pass the way I am working as a T (parameter). I forgot to do this, how clumsy!

thanks

A suspicious bool There is a habit of going back, not an object when the situation has not been completed, then what are you returning? Given your example, you do not really mean that returns is an object - this means that takes returns an object and bool is.

Note that if you are going to a parameter in Lambda expression, then you have to use a representative who also takes the parameters.

We must have a definite

or

 

zero law test (funk & lt ; HtmlImage, bool & gt; (Personally I like the descriptive nature of using the nominated representative, but others like using Func / . Code for almost all things> verb ).

Assuming that the type of input is fixed, if not, then you can make it a common method:

  zero met HodTest & lt; T & gt; (valid & lt; T & gt; forecast)  

Comments

Popular posts from this blog

MySql variables and php -

url rewriting - How to implement the returnurl like SO in PHP? -

Which Python client library should I use for CouchdB? -