I'm checking if an object is already inside my list, this object has an property with a value in it. If the object is already in the list I would like to get the object back and add the values together and then put it back in the list.
Here is my code:
if (!uniqueList.Contains(element))
{
uniqueList.Add(element);
}
else
{
elementOld = uniqueList ??
elementOld.value += element.value;
uniqueList.add(elementOld);
}
I just need help with the two ?? in the code.