Sobes.tech
Junior — Senior

Adding an event that responds to changes in the List1 list

livecode

Task condition

In the class SomeClass, there is a property List1. It is necessary to implement an event List1Changed, which should be triggered every time the list List1 changes (for example, after assigning a new value). This event should be invoked in the current code when filtering List1 in the Method1() method.

public class SomeClass
{
    public List<string> List1 {get;set;} = new List<string>() {"string", "string2", "string3"};

    public void Method1()
    {
        var list2 = new List<string>(List1.Where(x => x.StartsWith()));
    }
}