有没有办法从 IEnumerable 中提取 X 元素?
尝试过:
listPacchetti[2]
但根本不起作用。事实上我应该执行这段代码:
IList<SomeObject> listPacchetti = (
from SomeObject myso in SomeObjects
select myso)
.ToList();
int randInd = r.Next(1, listPacchetti.Length);
var temp = listPacchetti[2];
使用 IEnumerable。
还有其他解决方法/进一步的方法吗?谢谢
Tried with:
listPacchetti[2]
but it doesnt works at all. In fact I should do this code :
IList<SomeObject> listPacchetti = (
from SomeObject myso in SomeObjects
select myso)
.ToList();
int randInd = r.Next(1, listPacchetti.Length);
var temp = listPacchetti[2];
using an IEnumerable.
Any other workaround/further way? Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以 ElementAt() 或ELementAtOrDefault() 方法。
You can the ElementAt() or ELementAtOrDefault() method.