private ReflectionResult GetCurrentProperty(object source, string property, int level) { if (source == null && Mode == ReflectionMode.Loose) { return new ReflectionResult { Result = null } } ; var propertyHandler = DeterminePropertyHandlerCached(source, property); if (propertyHandler.ReflectionException != null) { return(new ReflectionResult { ReflectionException = propertyHandler.ReflectionException }); } ReflectionResult result = propertyHandler.PropertyHandler.Get(property, source, level); if (result.Result != null) { result.Result = Resolve(result.Result); } if (result.Result != null) { result.Full = true; } return(result); }
private static ReflectionResult GetDictionary(string property, object source) { try { var sourceAsList = (IDictionary)source; var result = new ReflectionResult { Result = sourceAsList[property] }; if (result.Result == null) { result.Full = sourceAsList.Contains(property); } return(result); } catch (KeyNotFoundException e) { return(new ReflectionResult { ReflectionException = ReflectionException.KeyNotFound(property) }); } }