A parameter problem of generic method

public static string GetTreeJsonByList<T>(List<T> list, Func<T, bool> filter, string pn, string In)
{
    //
}
Mar.13,2021

wrote you an example of a call to .NET Core 2 for reference:

using System;
using System.Collections.Generic;

namespace GenericMethodDemo {
    class Program {
        static void Main (string[] args) {
            var trees = new List<Tree> { };

            //GetTreeJsonByList2

            // 1.filternull
            var result1 = GetTreeJsonByList (trees, null, "pn", "In");
            Console.WriteLine ($"result 1:{result1}");

            // 2.filternull
            var result2 = GetTreeJsonByList (trees, x => x.Id > 100, "pn", "In");
            Console.WriteLine ($"result 2:{result2}");

            Console.ReadKey ();
        }

        public static string GetTreeJsonByList<T> (List<T> list, Func<T, bool> filter, string pn, string In) {
            //
            return "output";
        }
    }

    public class Tree {
        public int Id { get; set; }
        public string Name { get; set; }
        public int Sort { get; set; }
    }
}
Note: the generic T in the above call example is: Tree this entity object.

if you have any questions related to .NET development, you can go to a community of programming enthusiasts who focus on .NET development-Tuxing.com to find the answer. In the development of .NET, help you find more beautiful and advanced solutions to difficult problems

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e39781-58abf.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e39781-58abf.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?