Back
Theme:

Verificar todos se todos os items são iguais


Eu preciso verificar se todos os itens são iguais de uma lista para uma certa propriedade usando a linguagem c#

Date: Wednesday, February 1, 2023
1 answers | 377 view(s)
by Mauricio Junior

Answers

Você pode usar o .All e verificar com o primeiro código, veja o exemplo de código.

//check all items are the same of the first //add the first to the tagcode if (order.Items.All(x => x == order.Items.FirstOrDefault())) { header.TagCode = order.Items.FirstOrDefault().TagCode; }

Espero ter ajudado. ecode10.com

Wednesday, February 1, 2023

Mauricio Junior


Learn database step by step in practice