当前位置:网站首页>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
边栏推荐
- Unity synergy
- AutoCAD - Document Management
- 【acwing】836. Merge sets
- CUDA Programming atomic operation atomicadd reports error err:msb3721, return code 1
- MySQL in-depth learning - index creation and deletion, index design principles, index failure scenarios, query optimization, index push down ICP
- History of web page requests
- mysql審計日志歸檔
- "Measuring curve length" of CAD dream drawing
- 介绍汉明距离及计算示例
- 2022 U.S. college students' mathematical modeling e problem ideas / 2022 U.S. game e problem analysis
猜你喜欢
Download the details and sequence of the original data access from the ENA database in EBI
Number theoretic function and its summation to be updated
LeetCode之单词搜索(回溯法求解)
[Business Research Report] Research Report on male consumption trends in other economic times -- with download link
MySQL in-depth learning - index creation and deletion, index design principles, index failure scenarios, query optimization, index push down ICP
【acwing】837. Number of connected block points
PostgreSQL surpasses mysql, and the salary of "the best programming language in the world" is low
【Leetcode】1352. 最后 K 个数的乘积
質量體系建設之路的分分合合
The 22nd Spring Festival Gala, an immersive stage for the yuan universe to shine into reality
随机推荐
[groovy] closure closure (customize closure parameters | customize a single closure parameter | customize multiple closure parameters | specify the default value of closure parameters)
[crampon game] MC tutorial - first day of survival
AutoCAD - feature matching
Flutter 小技巧之 ListView 和 PageView 的各种花式嵌套
AutoCAD - Document Management
Introduce Hamming distance and calculation examples
Panel panel of UI
Flink集群配置
[crampon programming] lintcode decoding Encyclopedia - 872 termination process
[goweb development] Introduction to authentication modes based on cookies, sessions and JWT tokens
Personal required code
猿人学第一题
Unity get component
Forecast report on research and investment prospects of Chinese wormwood industry (2022 Edition)
AutoCAD - set layer
How to choose a panoramic camera that suits you?
【Leetcode】1352. Product of the last K numbers
Unity parallax infinite scrolling background
English topic assignment (26)
Unity3d learning notes