Editare

Partajați prin


Unit.ToString Method

Definition

Converts a Unit to a string equivalent.

Overloads

ToString()

Converts a Unit to a String.

ToString(CultureInfo)

Converts a Unit to a string equivalent in the specified culture.

ToString(IFormatProvider)

Converts a Unit to a string equivalent using the specified format provider.

ToString()

Converts a Unit to a String.

public:
 override System::String ^ ToString();
public override string ToString ();
override this.ToString : unit -> string
Public Overrides Function ToString () As String

Returns

A String that represents this Unit.

See also

Applies to

ToString(CultureInfo)

Converts a Unit to a string equivalent in the specified culture.

public:
 System::String ^ ToString(System::Globalization::CultureInfo ^ culture);
public string ToString (System.Globalization.CultureInfo culture);
override this.ToString : System.Globalization.CultureInfo -> string
Public Function ToString (culture As CultureInfo) As String

Parameters

culture
CultureInfo

A CultureInfo that represents the culture.

Returns

A String represents this Unit in the culture specified by culture.

Remarks

Use the ToString method to convert the Unit that this method is called from to a string equivalent in the specified culture.

See also

Applies to

ToString(IFormatProvider)

Converts a Unit to a string equivalent using the specified format provider.

public:
 System::String ^ ToString(IFormatProvider ^ formatProvider);
public string ToString (IFormatProvider formatProvider);
override this.ToString : IFormatProvider -> string
Public Function ToString (formatProvider As IFormatProvider) As String

Parameters

formatProvider
IFormatProvider

An IFormatProvider interface implementation that supplies culture-specific formatting information.

Returns

A String representing this Unit in the format specified by formatProvider.

Remarks

The ToString method returns a string representation formatted with a unit Value and an abbreviation representing the unit Type. The following table lists UnitType values and their corresponding abbreviation.

Unit type Abbreviation
Pixel px
Point pt
Pica pc
Inch in
Mm mm
Cm cm
Percentage %
Em em
Ex ex

Use formatProvider to specify culture-specific information used to format the Value. If formatProvider is null, the numeric portion of the string is formatted using a default NumberFormatInfo object set for the current culture.

See also

Applies to