ConversionCache<TKey, TValue> Class

Summary

[Editor-Only] A simple system for converting objects and storing the results so they can be reused to minimise the need for garbage collection, particularly for string construction.
Assembly
Animancer.dll
Namespace
Animancer.Editor
Base Types
  • Object
graph BT Type-->Base0["Object"] Type["ConversionCache<TKey, TValue>"] class Type type-node

Syntax

public class ConversionCache<TKey, TValue>

Remarks

This class doesn't use any Editor-Only functionality, but it's unlikely to be useful at runtime.

Type Parameters

Name Description
TKey
TValue

Constructors

Name Summary
ConversionCache(Func<TKey, TValue>) Creates a new Animancer.Editor.ConversionCache`2 which uses the specified delegate to convert values.

Methods

Name Value Summary
Convert(TKey) TValue
If a value has already been cached for the specified `key`, return it. Otherwise create a new one using the delegate provided in the constructor and cache it.

If the `key` is null, this method returns the default TValue.