예제 #1
0
        Boolean TryReadAccessor(MemberInfo member, ref Object value, ref IMemberAccessor ac, ref List <MemberInfo> ms)
        {
            // 访问器直接写入成员
            if (!ac.Read(Host, member))
            {
                return(false);
            }

            // 访问器内部可能直接操作Hosts修改了父级对象,典型应用在于某些类需要根据某个字段值决定采用哪个派生类
            var obj = Host.Hosts.Peek();

            if (obj != value)
            {
                value = obj;
                ms    = GetMembers(value.GetType());
                ac    = value as IMemberAccessor;
            }

            return(true);
        }