Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 3 years ago.
I have this error and I do not understand why ..
System.Collections.Generic.List ' does not contain a definition for 'equals'
My list is a List < List < string > >
<tbody>
<tr>
@{
int nbItems = ViewBag.listDonnees.Count ;
bool colore ;
for(int cpt = 0; cpt < nbItems; cpt++)
{
colore = false ;
if(cpt + 1 < nbItems)
{
colore = @ViewBag.listDonnees[cpt].equals("#FFFFFF") || @ViewBag.listDonnees[cpt].equals("#FFD700") || @ViewBag.listDonnees[cpt].equals("#FF6347") ;
}
if(colore)
{
<td style="background-color:@ViewBag.listDonnees[cpt+1]">@ViewBag.listDonnees[cpt]</td>
cpt++;
}
else
{
<td>@ViewBag.listDonnees[cpt]</td>
}
}
}
</tr>
</tbody>
I tried to use "==" but I also have this error :
Unable to apply operator '==' to operands of type 'System.Collections.Generic.List ' and 'string'
Thank you for your help