当前位置:网站首页>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
边栏推荐
- AutoCAD - Zoom previous
- "Measuring curve length" of CAD dream drawing
- Sixth note
- PR first time
- 質量體系建設之路的分分合合
- A survey of automatic speech recognition (ASR) research
- Research and forecast report on China's solution polymerized styrene butadiene rubber (SSBR) industry (2022 Edition)
- AutoCAD - graphic input and output
- [PCL self study: feature9] global aligned spatial distribution (GASD) descriptor (continuously updated)
- Research and investment forecast report of adamantane industry in China (2022 Edition)
猜你喜欢
3dsmax snaps to frozen objects
3dsmax scanning function point connection drawing connection line
SQL set operation
次小生成树
Rip notes [rip message security authentication, increase of rip interface measurement]
Wan broadband access technology V EPON Technology
Is $20billion a little less? Cisco is interested in Splunk?
Solution of circular dependency
【acwing】837. Number of connected block points
Introduce Hamming distance and calculation examples
随机推荐
Séparation et combinaison de la construction du système qualité
次小生成树
[groovy] closure (closure call is associated with call method | call () method is defined in interface | call () method is defined in class | code example)
Emlog博客主题模板源码简约好看响应式
[groovy] closure (closure parameter binding | curry function | rcurry function | ncurry function | code example)
[Chongqing Guangdong education] National Open University 2047t commercial bank operation and management reference test in autumn 2018
Inline built-in function
SQLServer 存储过程传递数组参数
AutoCAD - set layer
[groovy] closure (closure parameter list rule | default parameter list | do not receive parameters | receive custom parameters)
Variable category (automatic, static, register, external)
"Measuring curve length" of CAD dream drawing
猿人学第一题
Sixth note
Autocad-- dynamic zoom
The principle of attention mechanism and its application in seq2seq (bahadanau attention)
中国溶聚丁苯橡胶(SSBR)行业研究与预测报告(2022版)
C iterator
Understand encodefloatrgba and decodefloatrgba
2022 thinking of mathematical modeling C problem of American college students / analysis of 2022 American competition C problem