コード例 #1
0
        public ReflectionResult Get(string property)
        {
            var own = Reflection.AcquirePropertyInfo(property, this);

            if (own.PropertyInfo == null)
            {
                return(_freeFields.Get(property));
            }
            try
            {
                var value = own.PropertyInfo.GetValue(this);
                return(new ReflectionResult
                {
                    Full = true,
                    Result = value
                });
            }
            catch (Exception e)
            {
                return(new ReflectionResult {
                    Full = true, ReflectionException = new ReflectionException(e.Message)
                });
            }
        }
コード例 #2
0
 public object this[string property]
 {
     get
     {
         var own = Reflection.AcquirePropertyInfo(property, this);
         if (own.PropertyInfo != null)
         {
             return(own.PropertyInfo.GetValue(this));
         }
         return(_freeFields[property]);
     }
     set
     {
         var own = Reflection.AcquirePropertyInfo(property, this);
         if (own.PropertyInfo != null)
         {
             own.PropertyInfo.SetValue(this, value);
         }
         else
         {
             _freeFields[property] = value;
         }
     }
 }
コード例 #3
0
        public object TryGet(string property)
        {
            var own = Reflection.AcquirePropertyInfo(property, this);

            return(own.PropertyInfo != null?own.PropertyInfo.GetValue(this) : _freeFields.TryGet(property));
        }