Table of Contents

Method ConvertToString

Namespace
Alternet.Drawing
Assembly
Alternet.UI.Common.dll

ConvertToString(Color?, ITypeDescriptorContext?, CultureInfo?)

Converts the specified color to its string representation, using the provided context and culture information if available.

public static string? ConvertToString(Color? color, ITypeDescriptorContext? context = null, CultureInfo? culture = null)

Parameters

color Color

The color to convert to a string. If the color is empty, an empty string is returned.

context ITypeDescriptorContext

An optional type descriptor context that can provide additional information about the conversion. May be null.

culture CultureInfo

An optional culture information object used to format the string output. If null, the invariant culture is used.

Returns

string

A string representation of the color. Returns the color's name for known or named colors, or a comma-separated list of ARGB components for other colors. Returns an empty string if the color is empty. Returns null if the color is null.

Remarks

For colors with an alpha value less than 255, the string includes the alpha component. The separator used between components is determined by the specified culture. This method is useful for serializing colors for display or storage in a culture-sensitive format.