ImportAttribute.RequiredCreationPolicy 属性

定义

获取或设置一个值,该值指示导入程序需要导出结果的特定 CreationPolicy,以满足此导入。Gets or sets a value that indicates that the importer requires a specific CreationPolicy for the exports used to satisfy this import.

public:
 property System::ComponentModel::Composition::CreationPolicy RequiredCreationPolicy { System::ComponentModel::Composition::CreationPolicy get(); void set(System::ComponentModel::Composition::CreationPolicy value); };
public System.ComponentModel.Composition.CreationPolicy RequiredCreationPolicy { get; set; }
member this.RequiredCreationPolicy : System.ComponentModel.Composition.CreationPolicy with get, set
Public Property RequiredCreationPolicy As CreationPolicy

属性值

以下值之一:One of the following values: 如果导入程序不需要特定 Any,则为 CreationPolicyAny, if the importer does not require a specific CreationPolicy. 这是默认设置。This is the default.

若要求容器中的所有部件共享所有已使用的导出,则为 SharedShared to require that all used exports be shared by all parts in the container.

若要求所有已使用的导出在容器中不共享,则为 NonSharedNonShared to require that all used exports be non-shared in a container. 在此情况下,每个部件都会收到各自的实例。In this case, each part receives their own instance.

适用于