当前位置:网站首页>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
边栏推荐
- Debug insights
- Sqlserver stored procedures pass array parameters
- Function template
- Personal required code
- English topic assignment (27)
- 2022 thinking of mathematical modeling a problem of American college students / analysis of 2022 American competition a problem
- The 22nd Spring Festival Gala, an immersive stage for the yuan universe to shine into reality
- 2022 thinking of Mathematical Modeling B problem of American college students / analysis of 2022 American competition B problem
- mysql审计日志归档
- Rip notes [rip three timers, the role of horizontal segmentation, rip automatic summary, and the role of network]
猜你喜欢
![Rip notes [rip three timers, the role of horizontal segmentation, rip automatic summary, and the role of network]](/img/e7/f699ee982ea325b8d04f8bd467a559.jpg)
Rip notes [rip three timers, the role of horizontal segmentation, rip automatic summary, and the role of network]

Introduction to JVM principle and process

Autocad-- Real Time zoom

Solutions and answers for the 2021 Shenzhen cup

AutoCAD - continuous annotation

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

Emlog博客主题模板源码简约好看响应式

Thinking of 2022 American College Students' mathematical modeling competition

Special information | finance, accounting, audit - 22.1.23

2021-10-29
随机推荐
2021 huashubei mathematical modeling idea + reference + paper
AutoCAD -- dimension break
[ideas] 2021 may day mathematical modeling competition / May Day mathematical modeling ideas + references + codes
2022 thinking of mathematical modeling D problem of American college students / analysis of 2022 American competition D problem
[groovy] closure (Introduction to closure class closure | this, owner, delegate member assignment and source code analysis)
Debug insights
Emlog博客主题模板源码简约好看响应式
[Business Research Report] Research Report on male consumption trends in other economic times -- with download link
Flink集群配置
2020-10-27
Is $20billion a little less? Cisco is interested in Splunk?
AutoCAD - Document Management
Solutions and answers for the 2021 Shenzhen cup
Forecast report on research and investment prospects of Chinese wormwood industry (2022 Edition)
Difference between singleton and factory pattern
MySQL audit log archiving
Unity synergy
3dsmax common commands
2021 electrician cup (the 12th "China Society of electrical engineering Cup" National Undergraduate electrician mathematical modeling) detailed ideas + codes + references
AutoCAD - workspace settings