Show / Hide Table of Contents

Class ItemList<TItem>

A generic list of items added by map generation steps, that tracks what generation step added what item.

Inheritance
Object
ItemList<TItem>
Implements
IEnumerable<ItemStepPair<TItem>>
IEnumerable
Namespace: GoRogue.MapGeneration.ContextComponents
Assembly: GoRogue.dll
Syntax
public class ItemList<TItem> : Object, IEnumerable<ItemStepPair<TItem>>, IEnumerable
Type Parameters
Name Description
TItem

Type of item being stored.

Constructors

ItemList()

Creates an empty item list.

Declaration
public ItemList()

ItemList(IEnumerable<ItemStepPair<TItem>>)

Creates a new item list and adds the given items to it.

Declaration
public ItemList(IEnumerable<ItemStepPair<TItem>> initialItems)
Parameters
Type Name Description
IEnumerable<ItemStepPair<TItem>> initialItems

Initial item/step pairs to add to the list.

ItemList(Int32)

Creates an empty item list with the specified initial capacity for items.

Declaration
public ItemList(int initialItemCapacity)
Parameters
Type Name Description
Int32 initialItemCapacity

Properties

Items

The list of items added.

Declaration
public IReadOnlyList<TItem> Items { get; }
Property Value
Type Description
IReadOnlyList<TItem>

ItemToStepMapping

A mapping of each item to the Name of the generation step that created the item.

Declaration
public IReadOnlyDictionary<TItem, string> ItemToStepMapping { get; }
Property Value
Type Description
IReadOnlyDictionary<TItem, String>

Methods

Add(TItem, String)

Adds an item to to the list.

Declaration
public void Add(TItem item, string generationStepName)
Parameters
Type Name Description
TItem item

The item to add.

String generationStepName

The Name of the generation step that created the item.

AddRange(IEnumerable<TItem>, String)

Adds the given items to the list.

Declaration
public void AddRange(IEnumerable<TItem> items, string generationStepName)
Parameters
Type Name Description
IEnumerable<TItem> items

The items to add.

String generationStepName

The Name of the generation step that created the items.

GetEnumerator()

Gets an enumerator of all items and the step that added them.

Declaration
public IEnumerator<ItemStepPair<TItem>> GetEnumerator()
Returns
Type Description
IEnumerator<ItemStepPair<TItem>>

Remove(TItem)

Removes the given item from the list.

Declaration
public void Remove(TItem item)
Parameters
Type Name Description
TItem item

Item to remove.

Remove(IEnumerable<TItem>)

Removes the given items from the list.

Declaration
public void Remove(IEnumerable<TItem> items)
Parameters
Type Name Description
IEnumerable<TItem> items

Items to remove.

Remove(Func<TItem, Boolean>)

Removes all items from the list for which the given function returns true.

Declaration
public void Remove(Func<TItem, bool> predicate)
Parameters
Type Name Description
Func<TItem, Boolean> predicate

Predicate to determine which elements to remove.

Implements

System.Collections.Generic.IEnumerable<T>
System.Collections.IEnumerable

Extension Methods

Utility.Yield<T>(T)
In This Article
Back to top Generated by DocFX