There is a list of SaveList. The SavedList object has the values ​​int lvl, string Value, and string Date. I need to get all the objects from the list that have lvl equal to 1st.

Ie: From this list

SaveList[0]: lvl = 1, Value = "987", Date = "01.02.2005" SaveList[1]: lvl = 2, Value = "123", Date = "06.07.2009" SaveList[2]: lvl = 1, Value = "654", Date = "23.05.2012" 

It should turn out like this.

 NewList[0]: lvl = 1, Value = "987", Date = "01.02.2005" NewList[1]: lvl = 1, Value = "654", Date = "23.05.2012" 

I apologize for any errors in the preparation of the question.

    1 answer 1

     class MyClass { public int lvl; public string Value; public string Date; } class Program { static void Main(string[] args) { List<MyClass> list = new List<MyClass>(); //заполняем список... List<MyClass> filtered = list.Where(item => item.lvl == 1).ToList(); } }