SizeConverter.CreateInstance(ITypeDescriptorContext, IDictionary) 方法

定義

藉由使用指定的物件屬性值組,來建立這個型別的物件。Creates an object of this type by using a specified set of property values for the object. 這對於建立擁有可變更屬性的不可變更物件非常有用。This is useful for creating non-changeable objects that have changeable properties.

public:
 override System::Object ^ CreateInstance(System::ComponentModel::ITypeDescriptorContext ^ context, System::Collections::IDictionary ^ propertyValues);
public override object CreateInstance (System.ComponentModel.ITypeDescriptorContext context, System.Collections.IDictionary propertyValues);
override this.CreateInstance : System.ComponentModel.ITypeDescriptorContext * System.Collections.IDictionary -> obj
Public Overrides Function CreateInstance (context As ITypeDescriptorContext, propertyValues As IDictionary) As Object

參數

context
ITypeDescriptorContext

TypeDescriptor,可透過它來提供其他內容。A TypeDescriptor through which additional context can be provided.

propertyValues
IDictionary

新屬性值的字典。A dictionary of new property values. 字典包含了一系列的名稱/值組,每一個都會從 GetProperties(ITypeDescriptorContext, Object, Attribute[]) 方法傳回一個屬性。The dictionary contains a series of name-value pairs, one for each property returned from the GetProperties(ITypeDescriptorContext, Object, Attribute[]) method.

傳回

新建立的物件,或 null (如果無法建立物件)。The newly created object, or null if the object could not be created. 預設實作會傳回 nullThe default implementation returns null.

適用於