Why are lambda expressions not “interned”?

前端 未结 6 905
-上瘾入骨i
-上瘾入骨i 2021-01-01 19:22

Strings are reference types, but they are immutable. This allows for them to be interned by the compiler; everywhere the same string literal appears, the same objec

6条回答
  •  天涯浪人
    2021-01-01 19:48

    Is there any reason why this behavior—one delegate instance for semantically identical anonymous methods—is not implemented?

    Yes. Because spending time on a tricky optimization that benefits almost no one takes time away from designing, implementing, testing and maintaining features that do benefit people.

提交回复
热议问题