Table of Contents

Struct RewardSet

Namespace
Nekoyume.Model.Coupons
Assembly
Lib9c.dll
public readonly struct RewardSet : IImmutableDictionary<int, uint>, IReadOnlyDictionary<int, uint>, IReadOnlyCollection<KeyValuePair<int, uint>>, IEnumerable<KeyValuePair<int, uint>>, IEnumerable, IEquatable<RewardSet>
Implements
Inherited Members

Constructors

RewardSet(Dictionary)

public RewardSet(Dictionary serialized)

Parameters

serialized Dictionary

RewardSet(IEnumerable<(int ItemId, uint Quantity)>)

public RewardSet(IEnumerable<(int ItemId, uint Quantity)> rewards)

Parameters

rewards IEnumerable<(int ItemId, uint Quantity)>

RewardSet(in ImmutableDictionary<int, uint>)

public RewardSet(in ImmutableDictionary<int, uint> rewards)

Parameters

rewards ImmutableDictionary<int, uint>

RewardSet(params (int ItemId, uint Quantity)[])

public RewardSet(params (int ItemId, uint Quantity)[] rewards)

Parameters

rewards (int ItemId, uint Quantity)[]

Properties

Count

Gets the number of elements in the collection.

public int Count { get; }

Property Value

int

The number of elements in the collection.

this[int]

Gets the element that has the specified key in the read-only dictionary.

public uint this[int key] { get; }

Parameters

key int

The key to locate.

Property Value

uint

The element that has the specified key in the read-only dictionary.

Exceptions

ArgumentNullException

key is null.

KeyNotFoundException

The property is retrieved and key is not found.

Keys

Gets an enumerable collection that contains the keys in the read-only dictionary.

public IEnumerable<int> Keys { get; }

Property Value

IEnumerable<int>

An enumerable collection that contains the keys in the read-only dictionary.

Values

Gets an enumerable collection that contains the values in the read-only dictionary.

public IEnumerable<uint> Values { get; }

Property Value

IEnumerable<uint>

An enumerable collection that contains the values in the read-only dictionary.

Methods

Add(int, uint)

Adds an element with the specified key and value to the dictionary.

public IImmutableDictionary<int, uint> Add(int key, uint value)

Parameters

key int

The key of the element to add.

value uint

The value of the element to add.

Returns

IImmutableDictionary<int, uint>

A new immutable dictionary that contains the additional key/value pair.

Exceptions

ArgumentException

The given key already exists in the dictionary but has a different value.

AddRange(IEnumerable<KeyValuePair<int, uint>>)

Adds the specified key/value pairs to the dictionary.

public IImmutableDictionary<int, uint> AddRange(IEnumerable<KeyValuePair<int, uint>> pairs)

Parameters

pairs IEnumerable<KeyValuePair<int, uint>>

The key/value pairs to add.

Returns

IImmutableDictionary<int, uint>

A new immutable dictionary that contains the additional key/value pairs.

Exceptions

ArgumentException

One of the given keys already exists in the dictionary but has a different value.

Clear()

Retrieves an empty dictionary that has the same ordering and key/value comparison rules as this dictionary instance.

public IImmutableDictionary<int, uint> Clear()

Returns

IImmutableDictionary<int, uint>

An empty dictionary with equivalent ordering and key/value comparison rules.

Contains(KeyValuePair<int, uint>)

Determines whether the immutable dictionary contains the specified key/value pair.

public bool Contains(KeyValuePair<int, uint> pair)

Parameters

pair KeyValuePair<int, uint>

The key/value pair to locate.

Returns

bool

true if the specified key/value pair is found in the dictionary; otherwise, false.

ContainsKey(int)

Determines whether the read-only dictionary contains an element that has the specified key.

public bool ContainsKey(int key)

Parameters

key int

The key to locate.

Returns

bool

true if the read-only dictionary contains an element that has the specified key; otherwise, false.

Exceptions

ArgumentNullException

key is null.

Equals(RewardSet)

Indicates whether the current object is equal to another object of the same type.

public bool Equals(RewardSet other)

Parameters

other RewardSet

An object to compare with this object.

Returns

bool

true if the current object is equal to the other parameter; otherwise, false.

Equals(object?)

Indicates whether this instance and a specified object are equal.

public override bool Equals(object? obj)

Parameters

obj object

The object to compare with the current instance.

Returns

bool

true if obj and this instance are the same type and represent the same value; otherwise, false.

GetEnumerator()

Returns an enumerator that iterates through the collection.

public IEnumerator<KeyValuePair<int, uint>> GetEnumerator()

Returns

IEnumerator<KeyValuePair<int, uint>>

An enumerator that can be used to iterate through the collection.

GetHashCode()

Returns the hash code for this instance.

public override int GetHashCode()

Returns

int

A 32-bit signed integer that is the hash code for this instance.

Remove(int)

Removes the element with the specified key from the immutable dictionary.

public IImmutableDictionary<int, uint> Remove(int key)

Parameters

key int

The key of the element to remove.

Returns

IImmutableDictionary<int, uint>

A new immutable dictionary with the specified element removed; or this instance if the specified key cannot be found in the dictionary.

RemoveRange(IEnumerable<int>)

Removes the elements with the specified keys from the immutable dictionary.

public IImmutableDictionary<int, uint> RemoveRange(IEnumerable<int> keys)

Parameters

keys IEnumerable<int>

The keys of the elements to remove.

Returns

IImmutableDictionary<int, uint>

A new immutable dictionary with the specified keys removed; or this instance if the specified keys cannot be found in the dictionary.

Serialize()

public Dictionary Serialize()

Returns

Dictionary

SetItem(int, uint)

Sets the specified key and value in the immutable dictionary, possibly overwriting an existing value for the key.

public IImmutableDictionary<int, uint> SetItem(int key, uint value)

Parameters

key int

The key of the entry to add.

value uint

The key value to set.

Returns

IImmutableDictionary<int, uint>

A new immutable dictionary that contains the specified key/value pair.

SetItems(IEnumerable<KeyValuePair<int, uint>>)

Sets the specified key/value pairs in the immutable dictionary, possibly overwriting existing values for the keys.

public IImmutableDictionary<int, uint> SetItems(IEnumerable<KeyValuePair<int, uint>> items)

Parameters

items IEnumerable<KeyValuePair<int, uint>>

The key/value pairs to set in the dictionary. If any of the keys already exist in the dictionary, this method will overwrite their previous values.

Returns

IImmutableDictionary<int, uint>

A new immutable dictionary that contains the specified key/value pairs.

TryGetKey(int, out int)

Determines whether this dictionary contains a specified key.

public bool TryGetKey(int equalKey, out int actualKey)

Parameters

equalKey int

The key to search for.

actualKey int

The matching key located in the dictionary if found, or equalkey if no match is found.

Returns

bool

true if a match for equalKey is found; otherwise, false.

TryGetValue(int, out uint)

Gets the value that is associated with the specified key.

public bool TryGetValue(int key, out uint value)

Parameters

key int

The key to locate.

value uint

When this method returns, the value associated with the specified key, if the key is found; otherwise, the default value for the type of the value parameter. This parameter is passed uninitialized.

Returns

bool

true if the object that implements the IReadOnlyDictionary<TKey, TValue> interface contains an element that has the specified key; otherwise, false.

Exceptions

ArgumentNullException

key is null.