T
T
tera10042019-02-28 21:53:43
C++ / C#
tera1004, 2019-02-28 21:53:43

How to edit a list item in C#?

How to edit an element in a list so that only one of the element's values ​​changes?
Below is a small sketch of mine, is the train of thought correct?

public static Payment EditPayment()
        {
            Console.Write("Введите код платежа: ");
            int C = int.Parse(Console.ReadLine());
            payments.FindAll(p => p.Code == C);
            foreach (Payment c in payments.FindAll(p => p.Code == C))
            {
                Console.WriteLine("\n Колонка: {0} \n" +
               "Дата:  {1}.{2}.{3} {4}:{5}:{6} \n" +
               "Марка бензина: {7} \n" +
               "Количество: {8} \n" +
               "Код платежа: {9}" +
               "\n===============================", c.Column, c.Dt.Year, c.Dt.Month, c.Dt.Day, c.Dt.Hour, c.Dt.Minute, c.Dt.Second, c.Petrol, c.Count, c.Code);

            }
            Console.WriteLine("Введите название пункта,который хотите изменить");
            string E = Console.ReadLine();
            E = E.ToLower();
            switch (E) {
                case "колонка":
                
                    {
                       
                        Console.WriteLine("Введите новое значение пункта Колонка");
                        byte edit_column = byte.Parse(Console.ReadLine());
                        return
                            new Payment();
                    }
                    break;

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question