What's the difference between CompositionBatch and catalogs?

前端 未结 1 866
南方客
南方客 2021-01-19 20:52

I\'m trying to wrap my brain around MEF, and one thing I\'m struggling with is CompositionBatch.

CompositionBatch appears to be a way to add or remove exports to the

1条回答
  •  离开以前
    2021-01-19 21:43

    If a type is in a catalog, MEF will create an object of that type when needed. A CompositionBatch lets you add objects to the composition that you've created yourself. We recommend sticking to catalogs in general, but there are situations where you need to create an object yourself, or it is created by some other component (for example the XAML parser) and you need to put it in the container.

    0 讨论(0)
提交回复
热议问题