< Summary

Information
Class: MyNet.Observable.Collections.Sorting.ExpressionSortingProperty<T>
Assembly: MyNet.Observable
File(s): https://raw.githubusercontent.com/sandre58/MyNet/85372080fe102cd9ee155ceab49ae000e7f66103/src/MyNet.Observable/Collections/Sorting/ExpressionSortingProperty.cs
Tag: 323_28699572109
Line coverage
100%
Covered lines: 3
Uncovered lines: 0
Coverable lines: 3
Total lines: 37
Line coverage: 100%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.ctor(...)100%11100%
ProvideExpression()100%11100%

File(s)

https://raw.githubusercontent.com/sandre58/MyNet/85372080fe102cd9ee155ceab49ae000e7f66103/src/MyNet.Observable/Collections/Sorting/ExpressionSortingProperty.cs

#LineLine coverage
 1// -----------------------------------------------------------------------
 2// <copyright file="ExpressionSortingProperty.cs" company="Stéphane ANDRE">
 3// Copyright (c) Stéphane ANDRE. All rights reserved.
 4// </copyright>
 5// -----------------------------------------------------------------------
 6
 7using System;
 8using System.ComponentModel;
 9using System.Linq.Expressions;
 10
 11namespace MyNet.Observable.Collections.Sorting;
 12
 13/// <summary>
 14/// Represents a sorting property defined by an expression, along with the sorting direction.
 15/// </summary>
 16/// <param name="expression">The expression that defines the sorting property.</param>
 17/// <param name="direction">The direction in which to sort the items.</param>
 18/// <typeparam name="T">The type of the items to be sorted.</typeparam>
 19public sealed class ExpressionSortingProperty<T>(Expression<Func<T, object?>> expression, ListSortDirection direction = 
 20{
 21    /// <summary>
 22    /// Gets the expression that defines the sorting property. This expression is used to determine the value of the pro
 23    /// </summary>
 3024    public Expression<Func<T, object?>> Expression { get; } = expression;
 25
 26    /// <summary>
 27    /// Gets the direction in which to sort the items based on this sorting property. The direction can be either ascend
 28    /// </summary>
 3029    public ListSortDirection Direction { get; } = direction;
 30
 31    /// <summary>
 32    /// Provides the expression that defines the sorting property. This method is part of the <see cref="ISortingPropert
 33    /// </summary>
 34    /// <returns>The expression that defines the sorting property.</returns>
 4535    public Expression<Func<T, object?>> ProvideExpression() => Expression;
 36}
 37