Επεξεργασία

Κοινή χρήση μέσω


TypeConverter.ConvertToString Method

Definition

Converts the specified value to a string representation.

Overloads

ConvertToString(ITypeDescriptorContext, CultureInfo, Object)

Converts the given value to a string representation, using the specified context and culture information.

ConvertToString(Object)

Converts the specified value to a string representation.

ConvertToString(ITypeDescriptorContext, Object)

Converts the given value to a string representation, using the given context.

ConvertToString(ITypeDescriptorContext, CultureInfo, Object)

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

Converts the given value to a string representation, using the specified context and culture information.

public:
 System::String ^ ConvertToString(System::ComponentModel::ITypeDescriptorContext ^ context, System::Globalization::CultureInfo ^ culture, System::Object ^ value);
public string ConvertToString (System.ComponentModel.ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value);
public string? ConvertToString (System.ComponentModel.ITypeDescriptorContext? context, System.Globalization.CultureInfo? culture, object? value);
member this.ConvertToString : System.ComponentModel.ITypeDescriptorContext * System.Globalization.CultureInfo * obj -> string
Public Function ConvertToString (context As ITypeDescriptorContext, culture As CultureInfo, value As Object) As String

Parameters

context
ITypeDescriptorContext

An ITypeDescriptorContext that provides a format context.

culture
CultureInfo

A CultureInfo. If null is passed, the current culture is assumed.

value
Object

The Object to convert.

Returns

An Object that represents the converted value.

Exceptions

The conversion cannot be performed.

Remarks

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.

Depending on the implementation of the value formatter, it might be possible to pass the returned string back into the value formatter to re-create an instance of the object.

See also

Applies to

ConvertToString(Object)

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

Converts the specified value to a string representation.

public:
 System::String ^ ConvertToString(System::Object ^ value);
public string ConvertToString (object value);
public string? ConvertToString (object? value);
member this.ConvertToString : obj -> string
Public Function ConvertToString (value As Object) As String

Parameters

value
Object

The Object to convert.

Returns

An Object that represents the converted value.

Exceptions

The conversion cannot be performed.

Examples

For an example on this function, see the TypeConverter class.

Remarks

Depending on the implementation of the value formatter, it might be possible to pass the returned string back into the value formatter to re-create an instance of the object.

Applies to

ConvertToString(ITypeDescriptorContext, Object)

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

Converts the given value to a string representation, using the given context.

public:
 System::String ^ ConvertToString(System::ComponentModel::ITypeDescriptorContext ^ context, System::Object ^ value);
public string ConvertToString (System.ComponentModel.ITypeDescriptorContext context, object value);
public string? ConvertToString (System.ComponentModel.ITypeDescriptorContext? context, object? value);
member this.ConvertToString : System.ComponentModel.ITypeDescriptorContext * obj -> string
Public Function ConvertToString (context As ITypeDescriptorContext, value As Object) As String

Parameters

context
ITypeDescriptorContext

An ITypeDescriptorContext that provides a format context.

value
Object

The Object to convert.

Returns

An Object that represents the converted value.

Exceptions

The conversion cannot be performed.

Remarks

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.

Depending on the implementation of the value formatter, it might be possible to pass the returned string back into the value formatter to re-create an instance of the object.

See also

Applies to