コード例 #1
0
        static void Main(string[] args)
        {
            List <Person> _persons = new List <Person>()
            {
                new Person()
                {
                    Id = 1, Name = "Joe"
                },
                new Person()
                {
                    Id = 2, Name = "James"
                },
                new Person()
                {
                    Id = 3, Name = "Nick"
                },
                new Person()
                {
                    Id = 4, Name = "Mike"
                },
                new Person()
                {
                    Id = 5, Name = "John"
                },
            };

            PersonHandler _personHandler = (Person person) => person.Id.ToString();

            IEnumerable <string> _personIds = _persons.Select(p => _personHandler.Invoke(p));

            foreach (var id in _personIds)
            {
                Console.WriteLine(string.Format("Id's : {0}", id));
            }
        }