Hello. I have a list. I want to change the last element in it. But without changing the object and / or variable. And when you change an item in the list, the variable also changes. How to do it?
class ClassM
{
public int value { get; set; }
}
ClassM dimTemp;
List<ClassM> lstData = new List<ClassM>();
lstData.LastOrDefault().value = dimTemp.value + lstData.LastOrDefault().value;
I need the value in dimTemp not to change. And it changes.