Table of Contents

Class AssetMap<T>

Namespace
Shard.Assets
Assembly
Shard.Assets.dll

Provides immutable lookups and effective tags for one published asset family.

public sealed class AssetMap<T> where T : notnull

Type Parameters

T
Inheritance
AssetMap<T>
Inherited Members

Properties

Count

public int Count { get; }

Property Value

int

IndexTable

public IReadOnlyDictionary<string, int> IndexTable { get; }

Property Value

IReadOnlyDictionary<string, int>

Indexed

public bool Indexed { get; }

Property Value

bool

this[string]

public T this[string key] { get; }

Parameters

key string

Property Value

T

Keys

public ImmutableArray<string> Keys { get; }

Property Value

ImmutableArray<string>

MaxId

Returns the size of the stable index space, including reserved values.

public int MaxId { get; }

Property Value

int

Methods

Contains(string)

public bool Contains(string key)

Parameters

key string

Returns

bool

IndexOf(string?)

Resolves an indexed asset key and returns the entry at index zero when the key is absent.

public int IndexOf(string? key)

Parameters

key string

Returns

int

TagsOf(string)

public IReadOnlySet<string> TagsOf(string key)

Parameters

key string

Returns

IReadOnlySet<string>

TryGet(int, out T)

Resolves a published asset by index. Returns false for invalid indices, unindexed maps, and reserved entries without a published asset.

public bool TryGet(int index, out T value)

Parameters

index int
value T

Returns

bool

TryGet(string, out T)

public bool TryGet(string key, out T value)

Parameters

key string
value T

Returns

bool

TryGetEntry(string, out string, out T)

Resolves an asset together with the key spelling it is published under.

public bool TryGetEntry(string key, out string normalizedKey, out T value)

Parameters

key string
normalizedKey string
value T

Returns

bool

TryGetIndex(string?, out int)

Tries to resolve a key without treating a missing entry as index zero.

public bool TryGetIndex(string? key, out int index)

Parameters

key string
index int

Returns

bool

TryGetKey(int, out string)

Resolves an assigned index to its published key, or its reserved spelling when no asset is published. Returns false for invalid indices and unindexed maps.

public bool TryGetKey(int index, out string key)

Parameters

index int
key string

Returns

bool