开发者

MEF and WPF. Lifetime of lazy(of T)?

开发者 https://www.devze.com 2023-02-28 17:29 出处:网络
1st i\'m newbie I import object/Class using lazy() now my questions are 1) what is the lifetime of my object?

1st i'm newbie

I import object/Class using lazy()

now my questions are

1) what is the lifetime of my object?

2) how this object dis开发者_StackOverflow中文版poses?

3) if Disposed manually can MEF later reinitialize it when i issue object.value?


Generally the lifetime of the object is the same as the lifetime of the container, and it is disposed with the container. The lifetime/disposal can happen earlier in some situations for NonShared parts. Here is an answer that goes into more detail on MEF part lifetime.

For your third question, the answer is no. Depending on what you're trying to do, ExportFactory might be what you're looking for. It will let you create and dispose multiple copies of a given export.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号