public FormatStringTest() { _yueluo = Yueluo.Create(); var _ = _yueluo.FormatToString(); _cachedObjectVisitor = _yueluo.V() .WithExtendObject <Yueluo, StringBuilder>() .ForEach((name, value, sb) => sb.AppendFormat("{0}:{1}{2}", name, value, Environment.NewLine)) .Cache(); }
public PropertyGetterTest() { _yueluo = Yueluo.Create(); _nameProperty = typeof(Yueluo).GetProperty(nameof(Yueluo.Name)); _ageProperty = typeof(Yueluo).GetProperty(nameof(Yueluo.Age)); _nameFunc = ValueGetter <Yueluo, string, string> .GetGetter(_nameProperty); _ = ValueGetter <Yueluo, int, int> .GetGetter(_ageProperty).Invoke(_yueluo); _ = ValueGetter <Yueluo> .GetGetter(_nameProperty).Invoke(_yueluo); }
public CacheVisitorTest() { _yueluo = Yueluo.Create(); var _ = _yueluo.FormatToString(); _cachedObjectVisitor = _yueluo.V() .WithExtendObject <Yueluo, StringBuilder>() .ForEach((name, value, sb) => sb.AppendFormat("{0}:{1}{2}", name, value, Environment.NewLine)) .Cache(); _propertyInfos = typeof(Yueluo).GetProperties(); }
public FuncSearchTest() { _yueluo = Yueluo.Create(); var propertyInfos = typeof(Yueluo).GetProperties().ToArray(); CreateCacheArrayD(propertyInfos); _switcher = ValueGetter.CreateGetter <Yueluo, object>(propertyInfos, info => Expression.SwitchCase(Expression.Constant(CreateFunc(info)), Expression.Constant(info))); _dic = propertyInfos.ToDictionary(x => x, CreateFunc); _nameP = typeof(Yueluo).GetProperty(nameof(Yueluo.Name)); _func = x => x.Name; }