Table of Contents

Class ByteSizeExtensions

Namespace
Tharga.Toolkit
Assembly
Tharga.Toolkit.Standard.dll

Provides extension methods for converting byte counts into human-readable size strings.

public static class ByteSizeExtensions
Inheritance
ByteSizeExtensions
Inherited Members

Methods

ToReadableByteSize(int, bool, int)

Converts an integer byte count into a human-readable size string (e.g. "1 KB" or "1 Kilobytes").

public static string ToReadableByteSize(this int byteCount, bool useFullUnit = false, int decimalPlaces = 0)

Parameters

byteCount int
useFullUnit bool
decimalPlaces int

Returns

string

ToReadableByteSize(long, bool, int)

Converts a long byte count into a human-readable size string with automatic unit scaling (e.g. "1 KB" or "1 Kilobytes").

public static string ToReadableByteSize(this long byteCount, bool useFullUnit = false, int decimalPlaces = 0)

Parameters

byteCount long
useFullUnit bool
decimalPlaces int

Returns

string