blob: bc6b67bb3381038b9e0ad0ec31e31681d0b620ee (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Tango.Touch.Controls
{
public interface IAutoCompleteProvider
{
IList Filter(IList list, String filter);
}
public class AutoCompleteProvider<T> : IAutoCompleteProvider
{
private Func<T, String, bool> _filter;
public AutoCompleteProvider(Func<T, string, bool> filter)
{
_filter = filter;
}
public IList Filter(IList list, String filter)
{
return list.Cast<T>().Where(x => _filter(x, filter)).ToList();
}
}
}
|