Beispiel #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);
        }
Beispiel #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);
 }