Class TypedAssetDelivery
Builds deterministic packet bodies from typed asset collections.
public static class TypedAssetDelivery
- Inheritance
-
TypedAssetDelivery
- Inherited Members
Methods
Array<TAsset, TWire>(AssetMap<TAsset>, Func<TAsset, string, TWire>)
Builds an array packet body from typed assets in deterministic key order.
[SuppressMessage("ReSharper", "ForeachCanBeConvertedToQueryUsingAnotherGetEnumerator")]
public static TWire[] Array<TAsset, TWire>(AssetMap<TAsset> assets, Func<TAsset, string, TWire> convert) where TAsset : notnull
Parameters
Returns
- TWire[]
Type Parameters
TAssetTWire
Indexed<TAsset, TWire>(AssetMap<TAsset>, Func<TAsset, string, TWire>, Func<string, TWire>)
Builds the Dictionary<int, TWire> body of an indexed store's update packet.
Every assigned index is emitted, ensuring that the resulting index space is dense.
Loaded assets are converted with convert, while reserved keys
without a loaded asset are created with reservedDefault.
public static Dictionary<int, TWire> Indexed<TAsset, TWire>(AssetMap<TAsset> assets, Func<TAsset, string, TWire> convert, Func<string, TWire> reservedDefault) where TAsset : notnull where TWire : class
Parameters
Returns
- Dictionary<int, TWire>
Type Parameters
TAssetTWire
Remarks
Reserved entries must always produce a valid wire value because the client indexes the resulting collection as a dense array and may fail if an assigned index is missing.
Stringed<TAsset, TWire>(AssetMap<TAsset>, Func<TAsset, string, TWire>)
Builds a packet body keyed by strings from typed assets in deterministic key order.
public static Dictionary<string, TWire> Stringed<TAsset, TWire>(AssetMap<TAsset> assets, Func<TAsset, string, TWire> convert) where TAsset : notnull
Parameters
Returns
- Dictionary<string, TWire>
Type Parameters
TAssetTWire