通过索引获取列表项 [英] Getting a list item by index
本文介绍了通过索引获取列表项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我最近开始使用从 Java 转移过来的 c#.我似乎无法找到如何通过索引获取列表项.在java中获取列表的第一项将是:
I've recently started using c# moving over from Java. I can't seem to find how to get a list item by index. In java to get the first item of the list it would be:
list1.get(0);
c# 中的等价物是什么?
What is the equivalent in c#?
推荐答案
list1[0];
假设列表的类型定义了索引器.
Assuming list's type has an indexer defined.
这篇关于通过索引获取列表项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文