3 ms·
What's a pair constructor? "=>" is the C# lambda operator, which makes an anonymous function. Args go on the left of it, the return value on the right. In most
by StrawberryFrog 17y ago
What's a pair constructor?
"=>" is the C# lambda operator, which makes an anonymous function. Args go on the left of it, the return value on the right. In most cases, the names given to args don't matter.
- jrockway 17y agoAh, then no, it's not a pair constructor.
- jrockway 17y ago(I should also say that in Perl it is, and that's why this code looks perfectly normal to me. I imagine it's frightening to a C# programmer!)
- StrawberryFrog 17y agoI imagine it's frightening to a C# programmer C# programmers everywhere are heartened by your condescension. Not. Thinking of it as a pair is not going to help you understand it. from TFA: The syntactic trick is how the API uses the name of the lambda’s parameter as the name of the HTML attribute If your function is passed a function of one parameter, then it is a bit of a hack to vary behaviour based on the name of that parameter. But I'm OK with it, since it works quite well.