Панель поиска с массивом - PullRequest
0 голосов
/ 27 мая 2020

Я пытаюсь использовать строку поиска с массивом

void Handle_SearchButtonPressed(object sender, System.EventArgs e)
        {
            Repositorio repo = new Repositorio();
            Cliente[] listacliente = repo.getCliente();
            List<Cliente> lst = listacliente.OfType<Cliente>().ToList();
            var ClienteSearched = lst.Where(l => l.Contains(SearchBar.Text));
            ListaClientes.ItemsSource = ClienteSearched;
        }

, но он не работает, я хотел бы знать, есть ли способ заставить его работать

это это класс

public class Cliente
    {
        [JsonProperty("Cliente1")]
        public string Cliente1 { get; set; }
        [PrimaryKey]
        public string Correo { get; set; }
        public string Telefono { get; set; }
        public string Calle { get; set; }
        public string Hab { get; set; }
        public string Ciudad { get; set; }
        public string Estado { get; set; }
        public Nullable<int> Zip { get; set; }
        public int Row { get; set; }
        public string Celular { get; set; }
        public string ID { get; set; }
    }
```
and this is the error


Error   CS1929  

1 Ответ

1 голос
/ 27 мая 2020

Cliente не имеет метода Contains. Вам нужно вызвать Contains для одного из свойств строки Cliente, например,

var ClienteSearched = lst.Where(l => l.Cliente1.Contains(SearchBar.Text));
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...