list.Exists()

作者:追风剑情 发布于:2014-6-18 22:17 分类:C#

using System;
using System.Collections.Generic;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            List<int> list = new List<int>();
            for (int i = 0; i < 20; i++)
                list.Add(i);

            if (list.Exists(ExistsMatch))
                Console.WriteLine("找到匹配项");
            else
                Console.WriteLine("未找到匹配项");

            Console.ReadKey();
        }

        static bool ExistsMatch(int p)
        {
            return p == 19;
        }
    }
}

标签: Exists

Powered by emlog  蜀ICP备18021003号-1   sitemap

川公网安备 51019002001593号