Home About Rice Downloads Documents Others Cooker CookerGX
Documents  >  Class  >  dictionary  >  Add(string,class)
dictionary class : Add(string,class) method

Description

Adds the specified key and value to the dictionary.

Syntax

dictionaryInstance.Add(string key, someClass value)

Arguments

ClassNameDescription
stringkeyKey to be added.
someClassvalueValue to be added.

Return value

None

Sample code

//anyDictionary is a instance of dictionary{string} type.

anyDictionary.Add("newKey","ww");

Notes

It's a wrapper of the System.Collections.Generic.Dictionary<TKey, TValue>.Add(TKey,TValue).

It throws UnknownException(ArgumentException) If an element with the same key already exists in the dictionary.

Links for reference

Copyright © Rice All rights reserved.