遍历强类型的泛型List< T>的最佳方法是什么? [英] What is the best way to iterate through a strongly-typed generic List<T>?
本文介绍了遍历强类型的泛型List< T>的最佳方法是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在C#.NET和VB.NET中遍历一个强类型泛型列表的最佳方法是什么?
解决方案
对于C#:
foreach(ObjectType中的ObjectType objectItem)
{
// ... do一些东西
从 Purple Ant :
pre $
对于objectTypeList中的每个objectItem作为ObjectType
'做一些事情'
Next
What is the best way to iterate through a strongly-typed generic List in C#.NET and VB.NET?
解决方案
For C#:
foreach(ObjectType objectItem in objectTypeList)
{
// ...do some stuff
}
Answer for VB.NET from Purple Ant:
For Each objectItem as ObjectType in objectTypeList
'Do some stuff '
Next
这篇关于遍历强类型的泛型List< T>的最佳方法是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文