示例#1
0
        protected override bool TryGetMemberImpl(string name, out object result)
        {
            var parentMember = ((dynamic)_parent)[name];

            if (parentMember == null)
            {
                result = new ZoneOnDemand(_zoneFactory, _parent, name);
                return(true);
            }

            result = parentMember;
            return(true);
        }
        public override bool TryGetMember(System.Dynamic.GetMemberBinder binder, out object result)
        {
            var name = binder.Name;

            if (!base.TryGetMember(binder, out result) || (null == result)) {
                // substitute nil results with a robot that turns adds a zone on
                // the parent when .Add is invoked
                result = new ZoneOnDemand(_zoneFactory, this, name);
                TrySetMemberImpl(name, result);
            }

            return true;
        }
示例#3
0
        public override bool TryGetMember(System.Dynamic.GetMemberBinder binder, out object result)
        {
            var name = binder.Name;

            if (!base.TryGetMember(binder, out result) || (null == result))
            {
                // substitute nil results with a robot that turns adds a zone on
                // the parent when .Add is invoked
                result = new ZoneOnDemand(_zoneFactory, this, name);
                TrySetMemberImpl(name, result);
            }

            return(true);
        }
        protected override bool TryGetMemberImpl(string name, out object result)
        {
            var parentMember = ((dynamic)_parent)[name];
            if (parentMember == null) {
                result = new ZoneOnDemand(_zoneFactory, _parent, name);
                return true;
            }

            result = parentMember;
            return true;
        }