using System;
using System.Collections.Generic;
using System.Linq;

namespace test
{
    class Program
    {
        static void Main(string[] args)
        {
            var datas = new List<testDto>() {
                new testDto{name="A",count=100 },
                new testDto{name="B",count=50 }
            };

            for (int i = 0; i < 5; i++)
            {
                var tempData = datas.Where(s => s.name == "A").FirstOrDefault();
                tempData.count -= 1;
                Console.WriteLine(tempData.count);
            }

            Console.WriteLine("--------------");
            foreach (var item in datas)
            {
                Console.WriteLine("name:" + item.name + ",count:" + item.count);
            }

            Console.ReadKey();
        }
    }

    public class testDto
    {
        public int count { get; set; }

        public string name { get; set; }
    }
}
