static void test() { Class1.Item a = new Class1.Item(); Type t = typeof(Class1); Type tinner = t.GetNestedType("Item", BindingFlags.NonPublic); PrivateObject o = new PrivateObject(tinner); o.SetFieldOrProperty("ID", "12345"); PrivateObject class1 = new PrivateObject(typeof(Class1)); dynamic list = (List<dynamic>)class1.GetFieldOrProperty("itemList"); list.Add(o.Target); Console.WriteLine(class1.GetFieldOrProperty("GetFromListID")); }
public void test11() { Class1.Item a = new Class1.Item(); }