当前位置:网站首页>C # traversal set
C # traversal set
2022-07-28 17:19:00 【LV Shiliang】
1. Enumeration type
// Traversing enumeration types Sample Enumeration names of foreach (string sp in Enum.GetNames(typeof(Sample))) { ary.Add(sp); } // Traversing enumeration types Sample Each enumeration value of foreach (string sp in Enum.GetValues(typeof(Sample))) { ary.Add(sp); }
2. Traverse ArrayList(Queue、Stack)
Here we use string For example , Of course ArrayList Elements in can be any data type , Confirm when traversing ArrayList All elements in are of the same data type .
// The traversal element is string Type of queue
foreach (string text in arraylist)
{
ary.Add(text);
} In addition, traversal Queue Queue and Stack Stack in the same way ArrayList Basically the same , You can use foreach To loop through , It's just that one is first in first out and the other is first in first out .
ArrayList list = new ArrayList();
//for Traverse
for (int i = 0; i < list.Count; i++)
{
SE se = (SE)list[i];
Console.WriteLine(se.Name);
}
//foreach Traverse
foreach (Object obj in list)
{
SE se = (SE)list[i];
Console.WriteLine(se.Name);
}
3.Winform Controls in forms
// Traverse to find the control in the main form , And remove the qualified controls from the form
foreach (Control ctl in this.Controls)
{
// Get and judge the control type or control name
if (ctl.GetType().Name.Equals("ListBox") || ctl.Name.Equals("listBox1"))
this.Controls.Remove(ctl);
} 边栏推荐
- Steps to configure V530 switch
- Codeforces round 770 (Div. 2) F. Fibonacci additions (construction + difference)
- Ugui learning notes (I) rendering level
- MySQL详细学习教程(建议收藏)
- Cf/atc/lc topic score website
- mysql 最大建议行数2000w,靠谱吗?
- 深入理解 DeepSea 和 Salt 部署工具 – Storage6
- Goweb开发之Beego框架实战:第四节 数据库配置及连接
- [deep learning]: day 9 of pytorch introduction to project practice: dropout implementation (including source code)
- Atcoder beginer contest 240 g.reporting Takahashi (classical problems of Combinatorial Mathematics)
猜你喜欢

线性代数及矩阵论(九)

mysql 最大建议行数2000w,靠谱吗?

Add differential pairs and connections in Ad

Microservice Architecture - service registry and service gateway (6.8) (Reprint)

Shopee code League 2022 - qualification round p3.connecting the numbers (segment tree / bipartite graph determination, to be discussed)

使用阿里云免费的SSL证书

Unity shader global fog effect

Round 1A 2022 - Code jam 2022 c.weightlifting (interval DP)
![[deep learning]: day 6 of pytorch introduction to project practice: multi-layer perceptron (including code)](/img/19/18d6e94a1e0fa4a75b66cf8cd99595.png)
[deep learning]: day 6 of pytorch introduction to project practice: multi-layer perceptron (including code)

Atcoder regular contest 133 d.range XOR (digital dp+ classification discussion)
随机推荐
Visual Studio 2012/2015发布Web应用连同.cs源码一起发布
利用SQL Server代理作业对数据库进行定时还原
华为Mate 40系列曝光:大曲率双曲面屏,5nm麒麟1020处理器!还将有天玑1000+的版本
kubenertes 1.16集群部署问题总结
数据库故障容错之系统时钟故障
Visual Studio 2015 团队开发之Azure DevOps篇
Go language slow entry - process control statement
Reasoning Over Semantic-Level Graph for Fact Checking
3D modeling tool Archicad 26 newly released
A total of 13billion flash and 400million MCU were shipped! In depth analysis of the three product lines of Zhaoyi innovation
飞马D200S无人机与机载激光雷达在大比例尺DEM建设中的应用
Realize the reset function of steering wheel UI with touch rotation and finger departure in unity
海康威视回应'美国禁令'影响:目前所使用的元器件都有备选
Unity shader screen post-processing
Janus series article 3 API usage guide videoroom creating a new video room
Differences between CNSA and CASC and CASIC
Educational codeforces round 126 (rated for Div. 2) f.teleporters (two sets and two points)
微服务架构-服务注册中心和服务网关(6.8) (转载)
Games101 assignment04 job 04
kubernetes service 原理解析