开发者

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

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜