Table of Contents

Class SizeEstimate

Namespace
ToSic.Sys.Memory
Assembly
ToSic.Sys.Core.dll

Estimate the size of something - usually for cache-size estimates.

[InternalApi_DoNotUse_MayChangeWithoutNotice]
public record SizeEstimate : IEquatable<SizeEstimate>
Inheritance
object
SizeEstimate
Implements

Constructors

SizeEstimate(int, int, int, bool, bool)

Estimate the size of something - usually for cache-size estimates.

public SizeEstimate(int Known = 0, int Estimated = 0, int Expanded = 0, bool IsUnknown = false, bool IsError = false)

Parameters

Known int

The known amount of data.

Estimated int

Any estimate, which will either replace the known amount or be added to it.

Expanded int
IsUnknown bool

Indicates if the size is unknown.

IsError bool

Indicates if there was an error estimating the size.

Properties

Estimated

Any estimate, which will either replace the known amount or be added to it.

public int Estimated { get; init; }

Property Value

int

Expanded

public int Expanded { get; init; }

Property Value

int

Icon

Size indication icon, which can be a warning, unknown, or check mark depending on the precision.

public string Icon { get; }

Property Value

string

IsError

Indicates if there was an error estimating the size.

public bool IsError { get; init; }

Property Value

bool

IsUnknown

Indicates if the size is unknown.

public bool IsUnknown { get; init; }

Property Value

bool

Known

The known amount of data.

public int Known { get; init; }

Property Value

int

Total

Total size, combining known and estimated sizes.

public int Total { get; }

Property Value

int

Operators

operator +(SizeEstimate, SizeEstimate)

Add two size estimates together. The known and estimated sizes are added, and the unknown and error flags are combined with a logical OR.

public static SizeEstimate operator +(SizeEstimate a, SizeEstimate b)

Parameters

a SizeEstimate

The first size estimate.

b SizeEstimate

The second size estimate.

Returns

SizeEstimate

The combined size estimate.

operator -(SizeEstimate, SizeEstimate)

Subtract one size estimate from another. The known and estimated sizes are subtracted, and the unknown and error flags are combined with a logical OR.

public static SizeEstimate operator -(SizeEstimate a, SizeEstimate b)

Parameters

a SizeEstimate

The first size estimate.

b SizeEstimate

The second size estimate.

Returns

SizeEstimate

The resulting size estimate after subtraction.