Added documentation

This commit is contained in:
Thorsten Sommer 2025-08-21 15:40:21 +02:00
parent 736e8ce42c
commit e48eccd19f
Signed by: tsommer
GPG Key ID: 371BBA77A02C0108

View File

@ -6,6 +6,15 @@ public static class ExpressionExtensions
{
private static readonly ILogger LOGGER = Program.LOGGER_FACTORY.CreateLogger(typeof(ExpressionExtensions));
/// <summary>
/// Extracts the member expression from a given lambda expression representing a property.
/// </summary>
/// <param name="expression">A lambda expression specifying the property for which the member expression is to be extracted.
/// The lambda expression body must represent member access.</param>
/// <typeparam name="TIn">The type of the object containing the property referenced in the lambda expression.</typeparam>
/// <typeparam name="TOut">The type of the property being accessed in the lambda expression.</typeparam>
/// <returns>The member expression that represents the property access.</returns>
/// <exception cref="ArgumentException">Thrown if the provided lambda expression does not represent a valid property expression.</exception>
public static MemberExpression GetMemberExpression<TIn, TOut>(this Expression<Func<TIn, TOut>> expression)
{
switch (expression.Body)