संपादित करें

इसके माध्यम से साझा किया गया


TypeConverter.CreateInstance Method

Definition

Re-creates an Object given a set of property values for the object.

Overloads

CreateInstance(ITypeDescriptorContext, IDictionary)

Creates an instance of the type that this TypeConverter is associated with, using the specified context, given a set of property values for the object.

CreateInstance(IDictionary)

Re-creates an Object given a set of property values for the object.

CreateInstance(ITypeDescriptorContext, IDictionary)

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

Creates an instance of the type that this TypeConverter is associated with, using the specified context, given a set of property values for the object.

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

Parameters

context
ITypeDescriptorContext

An ITypeDescriptorContext that provides a format context.

propertyValues
IDictionary

An IDictionary of new property values.

Returns

An Object representing the given IDictionary, or null if the object cannot be created. This method always returns null.

Remarks

Use this method for objects that are immutable, but for which you want to provide changeable properties.

Notes to Inheritors

Override this method if the type you want to convert must re-create the object to change its value.

Use the context parameter to extract additional information about the environment from which this converter is invoked. This parameter can be null, so always check it. Also, properties on the context object can return null.

The dictionary provided by the propertyValues parameter has a series of name/value pairs, one for each property returned from GetProperties(Object).

See also

Applies to

CreateInstance(IDictionary)

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

Re-creates an Object given a set of property values for the 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

Parameters

propertyValues
IDictionary

An IDictionary that represents a dictionary of new property values.

Returns

An Object representing the given IDictionary, or null if the object cannot be created. This method always returns null.

Remarks

Use this method for objects that are immutable, but for which you want to provide changeable properties.

The dictionary provided by the propertyValues parameter has a series of name/value pairs, one for each property returned from GetProperties.

See also

Applies to