public static IMemberAccessor GetNamedAccessor(Type type, string name)
        {
            var key = String.Concat("(", type.FullName, ")", name);

            if (!_namedAccessors.TryGetValue(key, out var result))
            {
                var propertyInfo = type.GetTypeInfo().GetProperty(name, BindingFlags.Public | BindingFlags.Instance);

                if (propertyInfo != null)
                {
                    result = new MethodInfoAccessor(propertyInfo.GetGetMethod());
                }

                if (result == null)
                {
                    var fieldInfo = type.GetTypeInfo().GetField(name, BindingFlags.Public | BindingFlags.Instance);

                    if (fieldInfo != null)
                    {
                        result = new DelegateAccessor((o, n) => fieldInfo.GetValue(o));
                    }
                }
            }

            return(result);
        }
        public static IMemberAccessor GetNamedAccessor(Type type, string name)
        {
            IMemberAccessor result = null;

            return(_namedAccessors.GetOrAdd($"{type.Name}-{name}", key =>
            {
                var propertyInfo = type.GetTypeInfo().GetProperty(name, BindingFlags.Public | BindingFlags.Instance);

                if (propertyInfo != null)
                {
                    result = new MethodInfoAccessor(propertyInfo.GetGetMethod());
                }

                if (result == null)
                {
                    var fieldInfo = type.GetTypeInfo().GetField(name, BindingFlags.Public | BindingFlags.Instance);

                    if (fieldInfo != null)
                    {
                        result = new DelegateAccessor((o, n) => fieldInfo.GetValue(o));
                    }
                }

                return result;
            }));
        }
        private static List <string> GetAllMembers(Type type)
        {
            if (!_typeMembers.TryGetValue(type, out var list))
            {
                list = new List <string>();

                foreach (var propertyInfo in type.GetTypeInfo().GetProperties(BindingFlags.Public | BindingFlags.Instance))
                {
                    list.Add(propertyInfo.Name);
                    var key = String.Concat("(", type.FullName, ")", propertyInfo.Name);
                    _namedAccessors[key] = new MethodInfoAccessor(propertyInfo.GetGetMethod());
                }

                foreach (var fieldInfo in type.GetTypeInfo().GetFields(BindingFlags.Public | BindingFlags.Instance))
                {
                    list.Add(fieldInfo.Name);
                    var key = String.Concat("(", type.FullName, ")", fieldInfo.Name);
                    _namedAccessors[key] = new DelegateAccessor((o, n) => fieldInfo.GetValue(o));
                }

                _typeMembers[type] = list;
            }

            return(list);
        }