The example below show a simple way to filter a CSLA object collection using the FilteredBindingList.
CountryReadOnlyCollection list = CountryReadOnlyCollection.GetList(); FilteredBindingList<CountryReadOnly> f = new FilteredBindingList<CountryReadOnly>(list); f.ApplyFilter("Code", "PH"); Trace.WriteLine(string.Format("Total Count: {0}", list.Count)); Trace.WriteLine(string.Format("Filter Count: {0}", f.Count)); Trace.WriteLine(string.Format("Name: {0}", f[0].Name)); Trace.WriteLine(string.Format("Currency: {0}", f[0].Currency));
Leave a comment