LifetimeContext.GetOrCreate Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Retrieves a shared part instance with the specified ID, or if the part instance can not be found, creates and shares a part instance using the specified creator within the specified operation.
public:
System::Object ^ GetOrCreate(int sharingId, System::Composition::Hosting::Core::CompositionOperation ^ operation, System::Composition::Hosting::Core::CompositeActivator ^ creator);
public object GetOrCreate (int sharingId, System.Composition.Hosting.Core.CompositionOperation operation, System.Composition.Hosting.Core.CompositeActivator creator);
member this.GetOrCreate : int * System.Composition.Hosting.Core.CompositionOperation * System.Composition.Hosting.Core.CompositeActivator -> obj
Public Function GetOrCreate (sharingId As Integer, operation As CompositionOperation, creator As CompositeActivator) As Object
Parameters
- sharingId
- Int32
The ID of the shared part.
- operation
- CompositionOperation
An operation in which to create a part, if necessary.
- creator
- CompositeActivator
An activator that can activate a new part instance, if necessary.
Returns
The new or retrieved part.
Remarks
This method is lock-free if the part instance already exists. If the part instance must be created, a lock will be taken that will serialize other writes that use this method (concurrent reads will continue to be safe and lock-free). It is important that the composition, and thus lock acquisition, is strictly leaf-to-root in the lifetime tree.
Applies to
.NET
フィードバック
https://aka.ms/ContentUserFeedback」を参照してください。
以下は間もなく提供いたします。2024 年を通じて、コンテンツのフィードバック メカニズムとして GitHub の issue を段階的に廃止し、新しいフィードバック システムに置き換えます。 詳細については、「フィードバックの送信と表示