Enhanced C#
Language of your choice: library documentation
Properties | Public Member Functions | List of all members
Loyc.Collections.IAutoCreatePool< in in TKey, out out TValue > Interface Template Reference

Represents a pool of objects in which an object is automatically created when requested by its key. More...


Source file:
Inheritance diagram for Loyc.Collections.IAutoCreatePool< in in TKey, out out TValue >:

Remarks

Represents a pool of objects in which an object is automatically created when requested by its key.

Template Parameters
TKeyKey type.
TValueValue type.

This design assumes that the values in the pool know their own key, so it implements IEnumerable{TValue} rather than IEnumerable{KeyValuePair{TKey,TValue}}.

Properties

TValue this[TKey key] [get]
 Gets or creates the value associated with the specified key. More...
 

Public Member Functions

TValue GetIfExists (TKey key)
 Gets the item with the specified key, if it was created earlier. More...
 

Member Function Documentation

◆ GetIfExists()

TValue Loyc.Collections.IAutoCreatePool< in in TKey, out out TValue >.GetIfExists ( TKey  key)

Gets the item with the specified key, if it was created earlier.

Returns
The value corresponding to the specified key, or default(TValue) if the value has not been created.

Property Documentation

◆ this[TKey key]

TValue Loyc.Collections.IAutoCreatePool< in in TKey, out out TValue >.this[TKey key]
get

Gets or creates the value associated with the specified key.

Exceptions
ArgumentOutOfRangeExceptionThe key was not valid for this list.
Parameters
keyA key object.
Returns
The associated value object, which is created automatically if it does not already exist.