本文整理匯總了VB.NET中System.ComponentModel.Composition.Hosting.CompositionContainer.Compose方法的典型用法代碼示例。如果您正苦於以下問題:VB.NET CompositionContainer.Compose方法的具體用法?VB.NET CompositionContainer.Compose怎麽用?VB.NET CompositionContainer.Compose使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類System.ComponentModel.Composition.Hosting.CompositionContainer
的用法示例。
在下文中一共展示了CompositionContainer.Compose方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的VB.NET代碼示例。
示例1: Part1
<Export()>
Public Class Part1
Public ReadOnly Property data As String
Get
Return "This is the example data!"
End Get
End Property
End Class
<Export()>
Public Class Part2
<Import()>
Public Property data As Part1
End Class
<Export()>
Public Class Part3
<Import()>
Public Property data As Part2
End Class
Sub Main()
Dim container As New CompositionContainer()
Dim batch As New CompositionBatch()
batch.AddPart(AttributedModelServices.CreatePart(New Part1()))
batch.AddPart(AttributedModelServices.CreatePart(New Part2()))
batch.AddPart(AttributedModelServices.CreatePart(New Part3()))
container.Compose(batch)
Dim _part As Part3
_part = container.GetExportedValue(Of Part3)()
Console.WriteLine(_part.data.data.data)
Console.ReadLine()
End Sub
開發者ID:VB.NET開發者,項目名稱:System.ComponentModel.Composition.Hosting,代碼行數:34,代碼來源:CompositionContainer.Compose