New to Telerik UI for .NET MAUIStart a free 30-day trial

Converts a number, representing a file size in bytes, to a human-readable string representation (e.g., KB, MB, GB).

Definition

Namespace:Telerik.Maui.Controls

Assembly:Telerik.Maui.Controls.dll

Syntax:

C#
public class HumanReadableFileSizeConverter : IValueConverter

Inheritance: objectHumanReadableFileSizeConverter

Implements: IValueConverter

Constructors

C#
public HumanReadableFileSizeConverter()

Properties

Gets a static instance of the HumanReadableFileSizeConverter.

C#
public static HumanReadableFileSizeConverter Instance { get; }

Methods

Converts a number, representing a file size in bytes, to a human-readable string using the specified format.

C#
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
Parameters:valueobject

The file size in bytes.

targetTypeType

The target type (not used).

parameterobject

The format string (optional, defaults to "{0:0.#} {1}").

cultureCultureInfo

The culture information (not used).

Returns:

object

A human-readable string representing the file size.

Not implemented. Throws NotImplementedException.

C#
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
Parameters:valueobject

The value to convert back.

targetTypeType

The target type.

parameterobject

The converter parameter.

cultureCultureInfo

The culture information.

Returns:

object

Throws NotImplementedException.

Exceptions:

NotImplementedException

Always thrown.