'C# filter list, All or with given value
In my list, each list item consist of 2 properties ProductCategory ProductId
In my items there is not 0 valued neither ProductId nor ProductCategory
If client sends me as ProductId = 0 Product Category = 0
So must return all items in the list
If client sends me as ProductId = 2 ProductCategory = 0 I must return Only 2 id product in all of the ProductCategory
Or
ProductId=0
ProductCategory=2
I must return all of the products in 2 id ProductCategory..
Or ProductId=3 ProductCategory=2
Return productId = 2 in product category 2
How can implement this code without using if else blocks? I have achieved this with 4 if/else blocks but I want to learn is there any better way
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
