contains

Summary

Checks if the specified key is in the dictionary.

Usage

public bool contains(string key)

Returns

A Boolean value representing whether the key is in the dictionary: true if the specified key is in the dictionary and false otherwise.

Parameters

key

The key to check.

Description

Checks if the specified key is in the dictionary. This method returns true if the specified key is in the dictionary; otherwise, this method returns false.

Examples

Basic Usage
1
2
3
4
5
6
7
8
import System;
 
Dictionary<int> dict = { a: 1, b: 2, c: 3 };
Console.log(dict.contains("a")); // true
Console.log(dict.contains("b")); // true
Console.log(dict.contains("c")); // true
Console.log(dict.contains("d")); // false
Console.log(dict.contains("z")); // false

Share

HTML | BBCode | Direct Link