Class NumberExtensions
- Namespace
- AetherUtils.Core.Extensions
- Assembly
- AetherUtils.Core.dll
Provides extension methods for manipulating various number objects.
public static class NumberExtensions
- Inheritance
-
NumberExtensions
- Inherited Members
Methods
FormatSize(ulong)
Formats a size in bytes (represented by an ulong value) to the next closest base-2 size
representation and appends its suffix to the end; uses
1024 as the conversion factor.public static string FormatSize(this ulong sizeInBytes)
Parameters
sizeInBytesulong- The size, in bytes, to format.
Returns
ToInches(double, double)
Get an absolute value in inches represented by the specified number of pixels.
[UsedImplicitly]
public static double ToInches(this double pixels, double dpi = 96)
Parameters
pixelsdouble- The number of pixels to convert.
dpidouble- The DPI (dots per inch) of the screen; defaults to
96.
Returns
- double
- The inches equivalent of the pixels.
Exceptions
- DivideByZeroException
- If
dpiwas 0.
ToPixels(double, double)
Get an absolute value in pixels represented by the specified number of inches.
[UsedImplicitly]
public static double ToPixels(this double inches, double dpi = 96)
Parameters
inchesdouble- The number of inches to convert.
dpidouble- The DPI (dots per inch) of the screen; default is
96.
Returns
- double
- The pixels equivalent of the inches.