【问题标题】:PropertyInfo getValue works so slowPropertyInfo getValue 工作太慢
【发布时间】:2014-07-25 08:50:55
【问题描述】:
PropertyInfo info =currentobject.getType.getproperty (propertychain)
currentobject=info.getvalue (currentobject)

当我放置一个字符串而不是 getValue 时,它​​的运行速度非常快。但是如果它返回一个对象,它会变得这么慢吗?

为什么会这样,是否有可能的解决方案/解决方法?

【问题讨论】:

标签: .net entity-framework propertyinfo


【解决方案1】:

假设您在相对较少的类上运行此方法,您可以缓存对属性 getter 的引用以消除一些反射开销。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2022-06-26
    • 1970-01-01
    • 2019-10-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-02-19
    相关资源
    最近更新 更多