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

通过其可提供附加上下文的 TypeDescriptorA 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.

返回

Object

新创建的对象;如果未能创建该对象,则为 nullThe newly created object, or null if the object could not be created. 默认实现返回 nullThe default implementation returns null.

适用于