CSLA.NET 5.4.2
CSLA .NET is a software development framework that helps you build a reusable, maintainable object-oriented business layer for your app.
ExpressionExtensions.cs
Go to the documentation of this file.
1//-----------------------------------------------------------------------
2// <copyright file="ExpressionExtensions.cs" company="Marimer LLC">
3// Copyright (c) Marimer LLC. All rights reserved.
4// Website: https://cslanet.com
5// </copyright>
6// <summary>Extension methods for Expression types</summary>
7//-----------------------------------------------------------------------
8using System.Collections.Generic;
9using System.Linq.Expressions;
10using System.Text;
11
12namespace Csla.Reflection
13{
17 public static class ExpressionExtensions
18 {
26 public static string GetKey<T>(this Expression<T> expression)
27 {
28 var list = new List<string>();
29 var member = expression.Body as MemberExpression;
30 while (member != null)
31 {
32 list.Insert(0, member.Member.Name);
33 member = member.Expression as MemberExpression;
34 }
35 return string.Join(".", list);
36 }
37 }
38}