private static IEnumerable <MemberInfo> GetPropertyChainMemberInfos(LambdaExpression expr) { var me = ExpressionTreeWalker.FindFirst <MemberExpression> (expr); while (me != null) { yield return(me.Member); me = me.Expression as MemberExpression; } }
private static IEnumerable <string> GetPropertyChainMembers(LambdaExpression expr) { var me = ExpressionTreeWalker.FindFirst <MemberExpression> (expr); while (me != null) { string propertyName = me.Member.Name; yield return(propertyName); me = me.Expression as MemberExpression; } }