using System.Collections.Generic;
using System.Linq.Expressions;
using System.Runtime.CompilerServices;
using MongoDB.Driver.Linq.Linq3Implementation.Reflection;
public class TestNestedType {
public Dictionary<string, string> Assets {get; set;} = new Dictionary<string, string>();
public static void Main()
Console.WriteLine("Hello World");
IReadOnlyDictionary<string, TestType> testDict = new Dictionary<string, TestType>();
TestNestedType testClass = new TestNestedType();
Assembly externalAssembly = Assembly.Load("MongoDB.Driver");
Type internalClassType = externalAssembly.GetType("MongoDB.Driver.Linq.Linq3Implementation.Reflection.IDictionaryMethod");
MethodInfo methodInfo = internalClassType.GetMethod("IsGetItemWithStringMethod", BindingFlags.Static | BindingFlags.Public);
foreach (var m in testClass.Assets.GetType().GetMethods()) {
var getItemMethod = testClass.Assets.GetType().GetMethod("get_Item");
var result = methodInfo.Invoke(null, new [] { getItemMethod });
Console.WriteLine("Pass MongoDB check?");
Console.WriteLine(result);
var param = Expression.Parameter(testClass.GetType(), "testClass");
MemberExpression me = Expression.Property(param, "Assets");
MethodCallExpression e = Expression.Call(me, getItemMethod, Expression.Constant("WebGL"));
Console.WriteLine(e.Method.Name);
Console.WriteLine(e.Object.ToString());
Console.WriteLine(e.NodeType.ToString());