Link to home
Start Free TrialLog in
Avatar of sukhoi35
sukhoi35

asked on

C# - What is => operator?

I have a reference to a stack object as shown below. I am aware of the "=" assignment operator and it's function. But, can I know what is the difference between assignment operator and the "=>" operator being used here?

var stackObj= new Stack<Action>();
stackObj.Push(() => Obj.calculate();
Avatar of Carl Tawn
Carl Tawn
Flag of United Kingdom of Great Britain and Northern Ireland image

The => operator is used for Lambda expressions. In your case it is a parameter-less Lambda expression that calls the calculate() method of Obj.
SOLUTION
Avatar of Carl Tawn
Carl Tawn
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of sukhoi35
sukhoi35

ASKER

Thank you!