I haven't really come across this syntax during my Programming classes in Uni before and I'm curious as to what it means.
The only times I've had to implement it was:
When I had to create a BackgroundWorker
that had to be added to the ProgressChanged
event
Invoke((MethodInvoker)(() => updatePing((int) e.UserState)));
When researching tutorials on using the Caliburn.Micro MVVM framework
NotifyOfPropertyChange(() => Count);
I have tried searching around on what this notation means but the special characters it uses seem to mess with google search and I have no idea what it is called.
/ˈduː.plə.keɪt/ to make an exact copy of something: The documents had been duplicated. Parenthood is an experience nothing else can duplicate.
idiom. 1. : so that there are two copies. We were required to fill out the paperwork in duplicate. : with an exact copy.
The =>
is syntax for a lambda expression.
The ()
signifies that there are no parameters - if there were parameters and the types could be inferred from context, they could be specified as something like this:
(x, y) => x + y
Or specifying the types explicitly
(int x, string y) => x + y.Length
If there's only one parameter and its type can be inferred, you don't need the brackets:
x => x.Length
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With