public static void PropertyPathHelper_Test() { var a = new A(); object valueA = PropertyPathHelper.GetValueFromPropertyInfo(a, "Value"); object valueB = PropertyPathHelper.GetValueFromPropertyInfo(a, "B.Value"); object valueC = PropertyPathHelper.GetValueFromPropertyInfo(a, "B.C.Value"); bool cachedA = PropertyPathHelper._cacheDic.ContainsKey(new Tuple <Type, string>(typeof(A), "Value")); bool cachedC = PropertyPathHelper._cacheDic.ContainsKey(new Tuple <Type, string>(typeof(C), "Value")); Assert.AreEqual("A", valueA); Assert.AreEqual("B", valueB); Assert.AreEqual("C", valueC); Assert.AreEqual("C", valueC); Assert.IsTrue(cachedA); Assert.IsTrue(cachedC); }
protected virtual IEnumerable getSubEntries(object item) { return(PropertyPathHelper.GetValueFromPropertyInfo(item, SubentriesPath) as IEnumerable); }
protected virtual string getValuePath(object item) { return(PropertyPathHelper.GetValueFromPropertyInfo(item, ValuePath) as string); }
protected virtual object getParent(object item) { return(PropertyPathHelper.GetValueFromPropertyInfo(item, ParentPath)); }
protected virtual string GetValuePath(object item) => PropertyPathHelper.GetValueFromPropertyInfo(item, ValuePath) as string;
protected virtual object GetParent(object item) => PropertyPathHelper.GetValueFromPropertyInfo(item, ParentPath);