在ObservableCollection中查找索引 [英] Finding an index in an ObservableCollection

查看:134
本文介绍了在ObservableCollection中查找索引的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这可能很简单,但是我还没有提出解决方案.

This may be very simple but I have not been able to come up with a solution.

我有一个:

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

此集合已填充,其中包含许多ProcessModel.

This collection is populated, with many ProcessModel's.

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

My question is that I have an ProcessModel, which I want to find in my _collection.

我想执行此操作,以便能够找到ProcessModel在_collection中的位置的索引,我不确定如何执行此操作.

I want to do this so I am able to find the index of where the ProcessModel was in the _collection, I am really unsure how to do this.

我想这样做是因为我想在ObservableCollection(_collection)中先获取N + 1的ProcessModel.

I want to do this because I want to get at the ProcessModel N+1 ahead of it in the ObservableCollection (_collection).

推荐答案

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

这篇关于在ObservableCollection中查找索引的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆