Stack Overflow en español Asked by elnapster on January 4, 2022
tengo la siguiente filtrado:
dtBahias = dtBahiasCompletas.AsEnumerable() .Where(row => row.Field<String>("BAHIA") != "A1") .OrderBy(row => row.Field<String>("BAHIA")) .CopyToDataTable();
Pero ahora quisiera que en lugar de un solo valor (A1) fueran varios valores (A1,A2,A3), así como en SQL Server utilizar la instrucción IN , pero no se si acá se podrá utilizar igual o parecido , para que pueda aceptar ese filtrado.
Puedes usar .Contains() para lograr chequear multiples valores:
valores = new string[] {"A1", "A2", "A3"};
dtBahias = dtBahiasCompletas.AsEnumerable() .Where(row => valores.Contains(row.Field<String>("BAHIA")) .OrderBy(row => row.Field<String>("BAHIA")) .CopyToDataTable();
Answered by F.Igor on January 4, 2022
1 Asked on August 26, 2021 by cristian-sierra
2 Asked on August 26, 2021 by ilce-gomez
2 Asked on August 26, 2021 by diego-sanchez
1 Asked on August 26, 2021 by xavier-romero
2 Asked on August 26, 2021 by jeancarlos733
1 Asked on August 26, 2021 by abatwaelquitol
1 Asked on August 26, 2021 by esteban-ali-yaez-badillo
1 Asked on August 26, 2021
2 Asked on August 26, 2021 by nicolas-oate
1 Asked on August 26, 2021
1 Asked on August 26, 2021 by eduardo-matijak
0 Asked on August 26, 2021 by andrs-domnguez
1 Asked on August 26, 2021 by tutos-tiles-para-gente-til-201
1 Asked on August 26, 2021 by max-vzquez
1 Asked on August 26, 2021
1 Asked on August 26, 2021 by alan-carlos-lopez
1 Asked on August 26, 2021 by diego-goncalves
Get help from others!
Recent Questions
Recent Answers
© 2023 AnswerBun.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP