コード例 #1
0
ファイル: Program.cs プロジェクト: IshayBalash/Csharp
        static void Main(string[] args)
        {
            List <Product> fullProductList = DBmanager.GetProductList();

            Console.WriteLine($"in the origen list there are {fullProductList.Count}");
            List <Product> filterProductList = BLL.BLL.GetFilterList();

            Console.WriteLine($"in the filter list there are {filterProductList.Count}");
            Console.WriteLine();
            Console.WriteLine("this is the products info:");
            Console.WriteLine();
            foreach (Product item in filterProductList)
            {
                Console.WriteLine($"ProductName {item.ProductName} CategoryName:{item.CategoryName} UnitPrice: {item.UnitPrice}");
            }
        }
コード例 #2
0
        public static List <Product> GetFilterList()
        {
            List <Product> FullProductList = DBmanager.GetProductList();

            if (FullProductList == null)
            {
                return(null);
            }
            List <Product> FilterProducts = new List <Product>();

            foreach (Product item in FullProductList)
            {
                if (item.ProductName.Length == item.CategoryName.Length)
                {
                    FilterProducts.Add(item);
                }
            }
            return(FilterProducts);
        }