Van*_*nel 2 c# observablecollection
我正在使用C#开发Windows Phone应用程序.
我有一个ObservableCollection定义如下:
public class StartingPersons
{
public string ImagePath { get; set; }
public string Name { get; set; }
public static ObservableCollection<StartingPersons> GetPersons()
{
...
}
}
Run Code Online (Sandbox Code Playgroud)
我想在StartingPerons.GetPersons()返回的ObservableCollection中搜索; 由NAME领域.
我怎样才能做到这一点?
谢谢.
就像是:
IEnumerable<StartingPersons> matches = StartingPersons.GetPersons()
.Where(p => p.Name == "...");
Run Code Online (Sandbox Code Playgroud)
这不是特定的ObservableCollection<T>- 基本上你应该看看LINQ,特别是LINQ to Objects.