RectangleConverter.CreateInstance(ITypeDescriptorContext, IDictionary) 方法

定义

已知对象的属性值集,创建此类型的实例。Creates an instance of this type given a set of property values for the object. 这对于不可变但仍要提供可变属性的对象很有用。This is useful for objects that are immutable but still want to provide 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

通过其可提供附加上下文的 ITypeDescriptorContextA ITypeDescriptorContext 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 a call to 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.

适用于