memberinfo

How to get MemberInfo of ArrayLength type expressions?

佐手、 提交于 2020-01-16 01:10:25
问题 Some trouble with UnaryExpression s. This works this way: Expression<Func<List<string>, object>> k = l => l.Count; //got member in this case like this var member = ((k.Body as UnaryExpression).Operand as MemberExpression).Member; In the above case the k.Body.NodeType was ExpressionType.Convert . But it's a little tricky with ExpressionType.ArrayLength . How would I get the PropertyInfo member similarly in the below case?: Expression<Func<string[], int>> k = l => l.Length; var member = ?? In