什么是对象的初始化工作?你是怎么做到这一点,有什么优势?
What is lazy initialization of objects? How do you do that and what are the advantages?
延迟初始化是你延迟(潜在的昂贵)对象的创建,直到刚刚在你真正需要它的性能优化。
Lazy Initialization is a performance optimization where you defer (potentially expensive) object creation until just before you actually need it.
一个很好的例子是不创建数据库连接了前面,但仅仅只之前,你需要从数据库中获取数据。
One good example is to not create a database connection up front, but only just before you need to get data from the database.
键这样做的原因是,(通常),您可以完全避免创建对象,如果你永远不需要它。
The key reason for doing this is that (often) you can avoid creating the object completely if you never need it.
上一篇:到WPF属性绑定到在C#中的applicationSettings的最好方法?绑定、属性、方法、WPF
下一篇:什么是您使用Windows Workflow Foundation的经验?经验、Windows、Workflow、Foundation