コード例 #1
0
        public override bool TryGetMember(GetMemberBinder binder, out object result)
        {
            if (members.ContainsKey(binder.Name))
            {
                result = members[binder.Name];
            }
            else
            {
                result = new NullExceptionPreventer();
            }

            return(true);
        }
コード例 #2
0
 // all member access to a NullExceptionPreventer will return a new NullExceptionPreventer
 // this allows for infinite nesting levels: var s = Obj1.foo.bar.bla.blubb; is perfectly valid
 public override bool TryGetMember(GetMemberBinder binder, out object result)
 {
     result = new NullExceptionPreventer();
     return(true);
 }