When I register a request and add "teams" to said request, it generates a list of the teams I have from the said client that I previously selected...
How can I check if this list is empty or not?
string Equipos = string.Empty;
List<string> EquiposNombre = new List<string>();
bool isEmpty = isEmpty(EquiposNombre);
if (isEmpty)
{
foreach (var ar in solicitud.ActivosReportados)
{
EquiposNombre.Add(Utilidades.ActivoNombrePorActivoTipoIdActivoId(ar.ActivoId,
ar.ActivoTipoId));
}
Equipos = string.Join(", ", EquiposNombre);
}
I have a boolean variable to check if it is empty but it does not work for me
To know if a list is empty you can do the following condition:
If the number of elements is equal to 0, it means that it is empty.
There is a method in linq that checks if a list or any instance that derives from IEnumerable is full or not. For example:
I hope it helps you Greetings!