c# - 在 ObservableCollection 中查找索引

标签 c# .net observablecollection

这可能很简单,但我还没有想出解决方案。

我有一个:

ObservableCollection<ProcessModel> _collection = new ObservableCollection<ProcessModel>();

此集合已填充,包含许多 ProcessModel。

我的问题是我有一个 ProcessModel,我想在我的 _collection 中找到它。

我想这样做,以便能够找到 ProcessModel 在 _collection 中所在位置的索引,我真的不确定该怎么做。

我想这样做是因为我想在 ObservableCollection (_collection) 中获得它前面的 ProcessModel N+1。

最佳答案

var x = _collection[(_collection.IndexOf(ProcessItem) + 1)];

关于c# - 在 ObservableCollection 中查找索引,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10618351/

相关文章:

c# - ObservableCollection 在删除时以一种奇怪的模式抛出 ArgumentException(Windows Phone LongListSelector)

wpf - Observable Collection 替换项目

c# - 如何在没有 Visual Studio 的情况下构建可移植类库?

c# - 是否有一种 API 可以处理 XP 和 Vista 中的任务计划程序?

c# - mongodb c# 驱动程序 - 继承、映射和序列化问题

c# - 谷歌日历 API V3

.NET 编码速度

.net - 审计日志方法的提示

c# - 如何在作为 List<string> 的 ObservableCollection 绑定(bind)属性(到 ListView)上调用 String.Join

c# - 在不知道 clientid 和 client secret 的情况下从刷新 token 获取访问 token