| | | 1 | | // ----------------------------------------------------------------------- |
| | | 2 | | // <copyright file="ExpressionFilter.cs" company="Stéphane ANDRE"> |
| | | 3 | | // Copyright (c) Stéphane ANDRE. All rights reserved. |
| | | 4 | | // </copyright> |
| | | 5 | | // ----------------------------------------------------------------------- |
| | | 6 | | |
| | | 7 | | using System; |
| | | 8 | | using System.Linq.Expressions; |
| | | 9 | | |
| | | 10 | | namespace MyNet.Observable.Collections.Filters; |
| | | 11 | | |
| | | 12 | | /// <summary> |
| | | 13 | | /// Represents a filter that uses an expression to define the filtering criteria. The filter is based on a property of t |
| | | 14 | | /// </summary> |
| | | 15 | | /// <typeparam name="T">The type of items to be filtered.</typeparam> |
| | | 16 | | /// <remarks> |
| | | 17 | | /// Initializes a new instance of the <see cref="ExpressionFilter{T}"/> class with the specified expression and predicat |
| | | 18 | | /// </remarks> |
| | | 19 | | /// <param name="expression">The expression that specifies the property to filter on.</param> |
| | | 20 | | public class ExpressionFilter<T>(Expression<Func<T, bool>> expression) : IFilter<T> |
| | | 21 | | { |
| | | 22 | | /// <summary> |
| | | 23 | | /// Gets the name of the property being filtered, which is extracted from the body of the expression. The property n |
| | | 24 | | /// </summary> |
| | | 25 | | /// <returns>The expression that specifies the property to filter on.</returns> |
| | 123 | 26 | | public Expression<Func<T, bool>> ProvideExpression() => expression; |
| | | 27 | | } |
| | | 28 | | |