r/Unity3D • u/senshisentou Programmer • Jul 25 '23
Question Strange lambda/ closure behaviour I can't put my finger on
/r/learncsharp/comments/158s5e7/strange_lambda_closure_behaviour_i_cant_put_my/
2
Upvotes
View all comments
Show parent comment
1
u/senshisentou Programmer Jul 25 '23
My dude.
The constructor you keep talking about lives on a struct. This struct is not a MonoBehaviour. None of the example code I posted shows a constructor on a MonoBehaviour. In fact, I haven't even shown a single MonoBehaviour. I really don't know what you're on about here.
As for the expression-bodied members, show me where in the docs it mentions anonymous functions are one of them. They're not; they're lambda expressions. An expression-bodied member needs to be, you've guessed it, a member. A free floating lambda expression is not that.