Disadvantages of Lazy?

后端 未结 7 1850
青春惊慌失措
青春惊慌失措 2021-01-31 14:37

I recently started using Lazy throughout my application, and I was wondering if there are any obvious negative aspects that I need to take into account when using Lazy<

7条回答
  •  难免孤独
    2021-01-31 15:02

    As with anything, Lazy can be used for good or for evil, hence a disadvantage: when used inappropriately, it can cause confusion and frustration. However, lazy initialization pattern has been around for years, and now that .NET BCL has an implementation developers don't need to reinvent the wheel yet again. What's more, MEF loves Lazy.

提交回复
热议问题