Search code examples
c#.net.net-core.net-core-2.0

C# Linq Net Core: Exclude Words which contain search term


How do I conduct String Not Contains 'paraphrase key term' in Linq Net Core 2?

For this one, trying to acquire in the list which do Not contain 'ag' in the Product Name.

foreach (var product in Products().Where(c=>c.ProductName.NotContains("ag")))

Solution

  • foreach (var product in Products().Where( c => !c.ProductName.Contains("ag")))
    

    Thats it