コード例 #1
0
            public static VisitErrorCode TryExecute(object target, PropertyPath propertyName, int index, ref ChangeTracker changeTracker, out int count)
            {
                var action = new GetCountFromActualTypeCallback(target, propertyName, index, ref changeTracker);

                PropertyBagResolver.Resolve(target.GetType()).Cast(ref action);
                changeTracker = action.m_ChangeTracker;
                count         = action.m_Count;
                return(action.m_ErrorCode);
            }
コード例 #2
0
        internal static VisitErrorCode TryGetCountImpl <TContainer>(ref TContainer container, PropertyPath propertyPath, int propertyPathIndex,
                                                                    ref ChangeTracker changeTracker, out int count)
        {
            var action = new GetCountAtPathGetter <TContainer>(propertyPath, propertyPathIndex);

            if (PropertyBagResolver.Resolve <TContainer>()
                .FindProperty(propertyPath[propertyPathIndex].Name, ref container, ref changeTracker, ref action))
            {
                count = action.Count;
                return(action.ErrorCode);
            }

            if (typeof(TContainer) != container.GetType())
            {
                return(GetCountFromActualTypeCallback.TryExecute(container, propertyPath, propertyPathIndex, ref changeTracker, out count));
            }

            count = -1;
            return(VisitErrorCode.InvalidPath);
        }