语言

TypeConverter.CreateInstance 方法

定义

为对象重新创建一个 Object 给定的一组属性值。

重载

名称 说明
CreateInstance(ITypeDescriptorContext, IDictionary)

创建此 TypeConverter 所关联的类型的实例,该实例使用指定的上下文,给定对象的一组属性值。

CreateInstance(IDictionary)

为对象重新创建一个 Object 给定的一组属性值。

CreateInstance(ITypeDescriptorContext, IDictionary)

Source:
TypeConverter.cs
Source:
TypeConverter.cs
Source:
TypeConverter.cs
Source:
TypeConverter.cs
Source:
TypeConverter.cs

创建此 TypeConverter 所关联的类型的实例,该实例使用指定的上下文,给定对象的一组属性值。

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

参数

context
ITypeDescriptorContext

提供格式上下文的一 ITypeDescriptorContext 个。

propertyValues
IDictionary

新属性值之一 IDictionary 。

返回

表示 Object 给定 IDictionary对象,或者 null 无法创建对象。 此方法始终返回 null。

注解

对不可变但要为其提供可更改属性的对象使用此方法。

继承者说明

如果要转换的类型必须重新创建对象以更改其值,请重写此方法。

使用 context 参数提取有关从中调用此转换器的环境的其他信息。 此参数可以是 null,因此请始终检查它。 此外,上下文对象的属性也可以返回 null。

参数提供的 propertyValues 字典具有一系列名称/值对,其中一个用于从中 GetProperties(Object)返回的每个属性。

另请参阅

适用于

CreateInstance(IDictionary)

Source:
TypeConverter.cs
Source:
TypeConverter.cs
Source:
TypeConverter.cs
Source:
TypeConverter.cs
Source:
TypeConverter.cs

为对象重新创建一个 Object 给定的一组属性值。

public:
 System::Object ^ CreateInstance(System::Collections::IDictionary ^ propertyValues);
public object? CreateInstance(System.Collections.IDictionary propertyValues);
public object CreateInstance(System.Collections.IDictionary propertyValues);
member this.CreateInstance : System.Collections.IDictionary -> obj
Public Function CreateInstance (propertyValues As IDictionary) As Object

参数

propertyValues
IDictionary

一 IDictionary 个表示新属性值字典。

返回

表示 Object 给定 IDictionary对象,或者 null 无法创建对象。 此方法始终返回 null。

注解

对不可变但要为其提供可更改属性的对象使用此方法。

参数提供的 propertyValues 字典具有一系列名称/值对,其中一个用于从中 GetProperties返回的每个属性。

另请参阅

适用于