Class CachedNumber

Namespace
TDMaker.Unity.Hud
Assembly
TDMaker.Unity.dll

Caches the string for an integer so frequently updated labels do not allocate: the text of every value seen is kept (NumberText; with a prefix or suffix, per cache), so a value that comes back costs nothing.

public sealed class CachedNumber
Inheritance
CachedNumber
Inherited Members

Constructors

CachedNumber(string, string)

Creates a cache with optional prefix and suffix.

public CachedNumber(string prefix = null, string suffix = null)

Parameters

prefix string
suffix string

Methods

Get(int)

Returns the text for number, rebuilding it only for a value not seen before.

public string Get(int number)

Parameters

number int

Returns

string