How do I access a Dictionary Item using Linq Expressions
问题 I want to build a Lambda Expression using Linq Expressions that is able to access an item in a 'property bag' style Dictionary using a String index. I am using .Net 4. static void TestDictionaryAccess() { ParameterExpression valueBag = Expression.Parameter(typeof(Dictionary<string, object>), "valueBag"); ParameterExpression key = Expression.Parameter(typeof(string), "key"); ParameterExpression result = Expression.Parameter(typeof(object), "result"); BlockExpression block = Expression.Block(