How do I create expression tree for reading a value by array access for an IDictionary<string,object>
?
I want to represent:
((IDictionary<string,object>)T)["Key Name"]
I can't find any example of ArrayAccess being used to access with string name. I want something like:
var parameterExpression = Expression.Parameter(typeof(IDictionary<string, object>));
var paramIndex = Expression.Constant("name");
var arrayAccess = Expression.ArrayAccess(parameterExpression, paramIndex);
I get error stating it is not an array. What is correct way to do this?
Aucun commentaire:
Enregistrer un commentaire