| | | 1 | | // ----------------------------------------------------------------------- |
| | | 2 | | // <copyright file="ExpressionGroupingProperty.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.Grouping; |
| | | 11 | | |
| | | 12 | | /// <summary> |
| | | 13 | | /// Represents a grouping property defined by an expression for items of type T. This class implements the <see cref="IG |
| | | 14 | | /// </summary> |
| | | 15 | | /// <param name="expression">The expression that defines the grouping property.</param> |
| | | 16 | | /// <typeparam name="T">The type of the items to be grouped.</typeparam> |
| | | 17 | | public sealed class ExpressionGroupingProperty<T>(Expression<Func<T, object?>> expression) : IGroupingProperty<T> |
| | | 18 | | { |
| | | 19 | | /// <summary> |
| | | 20 | | /// Gets the expression that defines the grouping property. This expression is used to determine the value of the pr |
| | | 21 | | /// </summary> |
| | 27 | 22 | | public Expression<Func<T, object?>> Expression { get; } = expression; |
| | | 23 | | |
| | | 24 | | /// <summary> |
| | | 25 | | /// Provides the expression that defines the grouping property. This method is part of the <see cref="IGroupingPrope |
| | | 26 | | /// </summary> |
| | | 27 | | /// <returns>The expression that defines the grouping property.</returns> |
| | 15 | 28 | | public Expression<Func<T, object?>> ProvideExpression() => Expression; |
| | | 29 | | } |
| | | 30 | | |