当前位置:网站首页>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
边栏推荐
- [groovy] closure (closure as function parameter | code example)
- [ideas] 2021 may day mathematical modeling competition / May Day mathematical modeling ideas + references + codes
- 2022 thinking of Mathematical Modeling B problem of American college students / analysis of 2022 American competition B problem
- Inline built-in function
- #775 Div.1 B. Integral Array 数学
- [Business Research Report] Research Report on male consumption trends in other economic times -- with download link
- Pdf to DWG in CAD
- Introduce Hamming distance and calculation examples
- Reading and visualization of DICOM, MHD and raw files in medical imaging
- Data security -- 14 -- Analysis of privacy protection governance
猜你喜欢

质量体系建设之路的分分合合
![[groovy] closure (closure as function parameter | code example)](/img/a6/a4ed401acfb61f85eb08daa15a8a80.jpg)
[groovy] closure (closure as function parameter | code example)

Unity3d learning notes

Redis 排查大 key 的4种方法,优化必备

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

Use assimp library to read MTL file data
![[goweb development] Introduction to authentication modes based on cookies, sessions and JWT tokens](/img/20/5c5550e6dabc76702f0e7ce3bef068.jpg)
[goweb development] Introduction to authentication modes based on cookies, sessions and JWT tokens

【acwing】240. food chain
![[groovy] closure (closure call is associated with call method | call () method is defined in interface | call () method is defined in class | code example)](/img/03/329adb314606f29c8a4cb2260e84c8.jpg)
[groovy] closure (closure call is associated with call method | call () method is defined in interface | call () method is defined in class | code example)
随机推荐
[groovy] closure (Introduction to closure class closure | closure parametertypes and maximumnumberofparameters member usage)
AutoCAD - Zoom previous
775 Div.1 B. integral array mathematics
Research and investment forecast report of adamantane industry in China (2022 Edition)
3dsmax2018 common operations and some shortcut keys of editable polygons
GameObject class and transform class of unity
AutoCAD - set layer
MySQL in-depth learning - index creation and deletion, index design principles, index failure scenarios, query optimization, index push down ICP
Difference between singleton and factory pattern
Special information | real estate and office buildings - 22.1.9
"Measuring curve length" of CAD dream drawing
Autocad-- Real Time zoom
Function template
中国聚氨酯硬泡市场调研与投资预测报告(2022版)
Variable category (automatic, static, register, external)
Sixth note
Detailed introduction of OSPF header message
AutoCAD - command repetition, undo and redo
AutoCAD - feature matching
MD5 bypass