insert

Summary

Inserts a key-value pair into the dictionary.

Usage

public void insert(string key, T value)

Parameters

key

The key to insert.

value

The value to associate with the inserted key.

Description

Inserts a key-value pair into the dictionary. This method is an alternative for the dict[key] = value syntax.

Examples

Basic Usage
1
2
3
4
5
6
7
8
9
import System;
 
Dictionary<int> dict = { a: 1, b: 2, c: 3 };
 
dict.insert("d", 4);
Console.log(dict["d"]); // 4
 
dict["e"] = 5; // does the same thing as 'insert'
Console.log(dict["e"]); // 5

Share

HTML | BBCode | Direct Link