SmartAPI
Open Source .NET RQL library for RedDot CMS / OpenText WSM Management Server
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Properties Pages
LINQExtension.cs
Go to the documentation of this file.
1 ï»¿using System;
2 using System.Collections.Generic;
3 using System.Linq;
4 using System.Text;
5 using erminas.SmartAPI.CMS;
6 
7 namespace erminas.SmartAPI.Utils
8 {
9  public static class LinqExtension
10  {
11  public static void Delete<T>(this IEnumerable<T> collection) where T : IDeletable
12  {
13  foreach (var t in collection)
14  {
15  t.Delete();
16  }
17  }
18 
19  public static void Delete<T>(this IEnumerable<T> collection, Func<T, bool> predicate) where T : IDeletable
20  {
21  foreach (var t in collection.Where(predicate))
22  {
23  t.Delete();
24  }
25  }
26  }
27 }