当前位置:网站首页>Basic knowledge points of dictionary
Basic knowledge points of dictionary
2022-07-05 04:55:00 【yaohuiyaoo】
1. Using dictionaries (Dictionary)
System.Collections.Generic;// Namespace
2. A dictionary is a mapping from a set of keys to a set ; Any key is unique , Key cannot be empty reference , If the value is of reference type , Can be null ;key and value Can be of any type
3.Dictionary< type 1, type 2> d=new Dictionary< type 1, type 2>();
4. Additive elements
d.Add( data 1, data 2);
3. adopt key Look for the element
d.Containskey( key )// Whether there is a value corresponding to the key change
4. adopt keyvaluepair Traverse keys and values
d.key: key
d.value: value
5. Traverse all keys
Dictionary< key , value >.KeyCollection keys=d.keys;
6. Traverse all values
Dictionary< key , value >.valueCollection values=d.Value;
7. Delete the specified key value
d.Remove( key )
Other common properties and methods
compare: Get to determine whether there is an equal in the dictionary
Count: Number of key value pairs
Item: Gets or sets the value of the specified key
keys: The set of keys
values: Collection of values
add: Add key value
Clear: Remove all keys and values
Contains Key: Determines whether the specified key is included
ContainsValue: Determine whether to include the specified value
Gettype: Get key value type
边栏推荐
- [Business Research Report] Research Report on male consumption trends in other economic times -- with download link
- Solution of circular dependency
- Sixth note
- Wenet: E2E speech recognition tool for industrial implementation
- [crampon game] MC tutorial - first day of survival
- stm32Cubemx(8):RTC和RTC唤醒中断
- English topic assignment (27)
- Error statuslogger log4j2 could not find a logging implementation
- 中国针状焦行业发展研究与投资价值报告(2022版)
- Mode in BST (binary tree & Notes on question brushing)
猜你喜欢
[groovy] closure (closure parameter list rule | default parameter list | do not receive parameters | receive custom parameters)
数论函数及其求和 待更新
Redis 排查大 key 的4种方法,优化必备
【acwing】240. food chain
[groovy] closure closure (customize closure parameters | customize a single closure parameter | customize multiple closure parameters | specify the default value of closure parameters)
MySQL in-depth learning - index creation and deletion, index design principles, index failure scenarios, query optimization, index push down ICP
C4D simple cloth (version above R21)
计组笔记(1)——校验码、原补码乘除计算、浮点数计算
JVM 原理和流程简介
2022 thinking of mathematical modeling D problem of American college students / analysis of 2022 American competition D problem
随机推荐
3dsmax snaps to frozen objects
【Leetcode】1352. Product of the last K numbers
English topic assignment (26)
Function overloading
Is $20billion a little less? Cisco is interested in Splunk?
质量体系建设之路的分分合合
Séparation et combinaison de la construction du système qualité
Looking at Chinese science and technology from the Winter Olympics: what is the mystery of the high-speed camera that the whole people thank?
【acwing】528. cheese
PR first time
On-off and on-off of quality system construction
PostgreSQL surpasses mysql, and the salary of "the best programming language in the world" is low
LeetCode之单词搜索(回溯法求解)
SQLServer 存储过程传递数组参数
猿人学第一题
MD5 bypass
AutoCAD - continuous annotation
Emlog blog theme template source code simple good-looking responsive
Forecast report on research and investment prospects of Chinese wormwood industry (2022 Edition)
MySQL audit log Archive