Lambda expressions and the Action<Object> delegate, further question

Hi I've looked through the documentation on Action<T> that I though was the answer to a similar question posted a few days ago, and I still don't understand how a delegate typed as Action<T> can represent a method which has no input parameters e.g. methods like:

e.g. see

In several examples of using Action<T> in Delegate commands, methods are being sent to the execute method using lambda expressions that output methods which don't themselves required any input paramters.

I think I must be missing something here. Can anybody help explain this apparent anomoly.
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Bob LearnedCommented:
I believe the disconnect is that you are seeing the Debug.Indent as one method, without any arguments, but that is not true.  You need to understand how lambda expressions work.  Lambda expressions are, in effect, anonymous methods that take one argument, and return a value.  In the case of the Action<T> delegate the return value is ignored.

This is the lambda expression that I am referring to, where the argument passed into the anonymous method is "x" (or the function pointer to the Debug.Indent method):

    ICommand _indentCommand =    new SimpleDelegateCommand( (x) => Debug.Indent() );


"This lambda expression is an anonymous method that takes one argument x, and returns x * 2.  In this case, the type of x and the type that the lambda returns are inferred from the type of the delegate to which the lambda is assigned."

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
quentinAAuthor Commented:
Many thanks
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.