In C#, Is Expression API better than Reflection

后端 未结 3 648
春和景丽
春和景丽 2020-12-12 13:20

Nowadays, I\'m exploring C# Expression APIs. So I could use some help understanding how it works, including the difference between Expression and Reflection. I also want to

3条回答
  •  时光取名叫无心
    2020-12-12 13:49

    This guy actually measured it.

    http://www.palmmedia.de/Blog/2012/2/4/reflection-vs-compiled-expressions-vs-delegates-performance-comparison

    In short: compiled expression that is cached to a static var and reused - performs much faster than reflection.

提交回复
热议问题