Interface IMergable
A string-keyed container the legacy deep merge (Merger) can read and write key by key: the legacy Dict is the one implementation. IsExpandable decides whether a merge may add keys or only overwrite existing ones.
[Obsolete("The legacy Dict's deep merge: use Gym.Envs.Info.Update (Python's dict.update: the new value wins, one level deep). Removed in 2.0 with Gym.Legacy.")]
public interface IMergable
- Extension Methods
Remarks
Obsolete with Dict (DR-56) and removed in 2.0; Info is the 2.0 dictionary, merged with Update(IEnumerable<KeyValuePair<string, object?>>).
Properties
Contents
The key-value pairs, in the implementation's order; the merge does not read it.
IEnumerable<KeyValuePair<string, object>> Contents { get; }
Property Value
Count
The number of keys; a merge from an IMergable with none returns at once.
int Count { get; }
Property Value
IsExpandable
Is it possible to add values of keys that do not present in Keys?
bool IsExpandable { get; }
Property Value
Keys
All current keys of this object.
IEnumerable<string> Keys { get; }
Property Value
Methods
Get(string)
Gets the value of key.
object Get(string key)
Parameters
keystringThe key to read.
Returns
- object
The value stored under
key.
Exceptions
- KeyNotFoundException
When
keyis not present (the legacy Dict indexes directly).
Merge(object, MergePrefer)
Performs a merge with object of unknown type: a dictionary, another IMergable, or a sequence of string-keyed pairs. Anything else merges nothing, silently.
void Merge(object right, MergePrefer preference)
Parameters
rightobjectobject to take data from
preferenceMergePrefersee the documentation on the enum values.
Set(string, object)
Assign value to given key.
void Set(string key, object value)
Parameters
Exceptions
- KeyNotFoundException
If IsExpandable is false and When the key is not present