public static VisitErrorCode TryExecute(object target, PropertyPath propertyName, int index, ref ChangeTracker changeTracker, out TValue value) { var action = new GetValueFromActualTypeCallback <TValue>(target, propertyName, index, ref changeTracker); PropertyBagResolver.Resolve(target.GetType()).Cast(ref action); value = action.m_Value; return(action.m_ErrorCode); }
static VisitErrorCode TryGetValueImpl <TContainer, TTargetValue>(ref TContainer container, PropertyPath propertyPath, int propertyPathIndex, ref ChangeTracker changeTracker, out TTargetValue value) { var action = new GetValueAtPathAction <TContainer, TTargetValue>(propertyPath, propertyPathIndex); if (PropertyBagResolver.Resolve <TContainer>() .FindProperty(propertyPath[propertyPathIndex].Name, ref container, ref changeTracker, ref action)) { value = action.Value; return(action.ErrorCode); } if (typeof(TContainer) != container.GetType()) { return(GetValueFromActualTypeCallback <TTargetValue> .TryExecute(container, propertyPath, propertyPathIndex, ref changeTracker, out value)); } value = default; return(VisitErrorCode.InvalidPath); }