Cool questions

Can someone explain what the syntax
param =>
means? I am not quite sure what the param variable is and where it is defined at.
The msdn library did not show param as an attribute.
And the operator => where does come from.
I do not see no IEnumerate interface involved here.
If anyone can reference me to a website to explain param and the => operator
I would greatly appreciate it or you can email me at
sun_Water_snow@hotmail.com and explain this to me.

RelayCommand _saveCommand;
public ICommand SaveCommand
{
get
{
if (_saveCommand == null)
{
_saveCommand = new RelayCommand(param => this.Save(),
param => this.CanSave );
}
return _saveCommand;
}

 

dfmartin72 wrote  Feb 23 2009 at 3:54 PM 

Steven: The "param =>" syntax is a Lambda extression which is an anonymous function. The RelayCommand object takes an Action<T> as a parameter which is a concrete delegate. By passing "param => this.Save()" you are essentially passing a delegate to the Save method into the constructor of the SaveCommand. For more information on Lambda check out: http://msdn.microsoft.com/en-us/library/bb397687.aspx