Table of Contents

Method DefaultGetItemText

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

DefaultGetItemText(object?, bool, IFormatProvider?)

Returns a string representation of the specified item, using display or value text as appropriate.

public static string DefaultGetItemText(object? item, bool forDisplay, IFormatProvider? formatProvider = null)

Parameters

item object

The item to convert to a string. Can be null.

forDisplay bool

true to use display text if available; otherwise, false to use value text.

formatProvider IFormatProvider

An object that supplies culture-specific formatting information, or null to use the current culture.

Returns

string

A string representation of the item. Returns an empty string if the item is null.

Remarks

If the item is a ListControlItem, the method returns the DisplayText, Text, or Value property, depending on the forDisplay parameter and property availability. For other types, the method uses the item's ToString implementation with the specified format provider.