TypeConverter.ConvertToInvariantString Method

Definition

Converts the specified value to a culture-invariant string representation.

Overloads

ConvertToInvariantString(Object)

Converts the specified value to a culture-invariant string representation.

ConvertToInvariantString(ITypeDescriptorContext, Object)

Converts the specified value to a culture-invariant string representation, using the specified context.

ConvertToInvariantString(Object)

Converts the specified value to a culture-invariant string representation.

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

Parameters

value
Object

The Object to convert.

Returns

A String that represents the converted value.

Exceptions

The conversion cannot be performed.

Remarks

The context parameter can be used to extract additional information about the environment from which this converter is being invoked. This can be null, so always check. 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

ConvertToInvariantString(ITypeDescriptorContext, Object)

Converts the specified value to a culture-invariant string representation, using the specified context.

public:
 System::String ^ ConvertToInvariantString(System::ComponentModel::ITypeDescriptorContext ^ context, System::Object ^ value);
public string ConvertToInvariantString (System.ComponentModel.ITypeDescriptorContext context, object value);
public string? ConvertToInvariantString (System.ComponentModel.ITypeDescriptorContext? context, object? value);
member this.ConvertToInvariantString : System.ComponentModel.ITypeDescriptorContext * obj -> string
Public Function ConvertToInvariantString (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

A String 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