相关疑难解决方法(0)

如何使这个LINQ搜索方法处理两个以上的术语?

下面的搜索方法的工作原理 罚款长达2项.

如何使其动态化以便能够处理任意数量的搜索项?

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

namespace TestContains82343
{
    class Program
    {
        static void Main(string[] args)
        {
            List<string> tasks = new List<string>();
            tasks.Add("Add contract to Customer.");
            tasks.Add("New contract for customer.");
            tasks.Add("Create new contract.");
            tasks.Add("Go through the old contracts.");
            tasks.Add("Attach files to customers.");

            var filteredTasks = SearchListWithSearchPhrase(tasks, "contract customer");

            filteredTasks.ForEach(t => Console.WriteLine(t));
            Console.ReadLine();
        }

        public static List<string> SearchListWithSearchPhrase(List<string> tasks, string searchPhrase)
        {
            string[] parts = searchPhrase.Split(new char[] { ' ' });
            List<string> …
Run Code Online (Sandbox Code Playgroud)

c# linq

3
推荐指数
1
解决办法
2616
查看次数

标签 统计

c# ×1

linq ×1