The question makes no sense, as most questions like "what's the difference"? "What's the difference between apple and Apple?" is the classic one :-). You could ask how are they related though.
Just learn both and see.
Lambda expression is kind of serious topic, start here:
http://msdn.microsoft.com/en-us/library/bb397687.aspx[
^].
Action it too simple. This
Action
and
Func
is overloaded set of delegate type declarations, declared in
System.Core
. If you know delegate types and delegates, there is nothing new. Microsoft just added a set of most typical generic delegate types for our convenience, in .NET v.3.5 I think. These declarations cover some 99.99% of practical cases.
They are often used together. This lambda expression is just a convenient way to add an anonymous method to the invocation list of some delegate. Compare:
Action<string, int> myDelegate;
myDelegate = delegate(string message, int index) {
};
myDelegate += new Action<string, int>((message, index) => {
});
In the lambda form, the convenience is that the types of
message
and
index
are not typed explicitly as they are inferred from the Action declaration. This can be very convenient, especially in events, where sender and event arguments parameters are inferred from the event type (you don't even repeat them in Action), because one or both parameters are often not even used, so finding exact type declarations could be a pure hassle with no purpose; type inference helps here.
Functionally, both ways are 100% identical.
There are much more fundamental and important uses of lambda, but I only focused on the aspect of using it with Action, to answer this question.
—SA