I have a list and I am trying to find a particular element and then I want to edit that element.
storage.First(item => item.dirty == true).dirty = false;
However this doesn’t appear to work since I am guessing First is creating another list and populating it. Is there a function to do what I am I am trying to do?
Here is the data type I am using:
class BaseRegister {
public bool dirty {set;get;}
}
List <BaseRegister> storage = new List <BaseRegister> ();
There must be something else wrong with your program which is confusing you. For the avoidance of doubt, here is a complete program using your data types. The output is:
The code is: