You get something like a Repository template, a collection in memory.
Two things are important here:
- How will you search for records. In the simplest case, use LINQ, or you can create a set of methods for finding the type FindById, FindByName, and others.
- How will you set the values. Your initial values ββare set through the constructor, and then what? You either make getters / setters, or write separate methods like SetUserName, etc.
The most commonplace way to modify your example:
static void Main(string[] args) { List<Users> lol = new List<Users>(); lol.Add(new Users("maks", "kovtun", 234234, "ΡΡΠ°ΡΠ½ΠΈΠΊ")); lol.Add(new Users("Jeka", "SKRT", 32552, "Π°ΠΊΡΠΈΠ²ΠΎΠ²Π°Π½ΠΈΠΉ")); lol.First(x => x.ID == 32552).FirstName = "wow"; } [Serializable] public class Users { public string FirstName; public string LastName; public int ID; public string Username; public Users() { } public Users(string fName, string lName, int id, string username) { this.FirstName = fName; this.LastName = lName; this.ID = id; this.Username = username; } }

And further. The example above is just to show direction. Consider how you will handle the situation where you will not have a record with ID = 123 in the repository. In the code above, you will either get an exception in First, or (if FirstOrDefault were there) you would get a null reference if you tried to access FirstName.
Therefore it is more correct to check if there is such an element:
var elem = lol.FirstOrDefault(x => x.ID == 32552); if (elem != null) { elem.FirstName = "wow"; }