mirror of
https://dev.azure.com/TeilRad/sharee.bike%20App/_git/Code
synced 2024-07-04 20:26:34 +02:00
21 lines
768 B
C#
21 lines
768 B
C#
|
using System.Collections.Generic;
|
|||
|
using System.Linq;
|
|||
|
|
|||
|
namespace TINK.Model.Connector.Filter
|
|||
|
{
|
|||
|
/// <summary> Filters to enumerations of string by intersecting.</summary>
|
|||
|
public class IntersectGroupFilter : IGroupFilter
|
|||
|
{
|
|||
|
private IEnumerable<string> Group { get; set; }
|
|||
|
|
|||
|
public IntersectGroupFilter(IEnumerable<string> group) => Group = group ?? new List<string>();
|
|||
|
|
|||
|
/// <summary> Applies filtering. </summary>
|
|||
|
/// <param name="filter">Enumeration of filter values to filter with or null if no filtering has to be applied.</param>
|
|||
|
/// <returns></returns>
|
|||
|
public IEnumerable<string> DoFilter(IEnumerable<string> filter) => filter != null
|
|||
|
? Group.Intersect(filter)
|
|||
|
: Group;
|
|||
|
}
|
|||
|
}
|