示例#1
0
        public override InspectorPropertyInfo GetChildInfo(int childIndex)
        {
            if (childIndex < 0 || childIndex >= this.ChildCount)
            {
                throw new IndexOutOfRangeException();
            }

            InspectorPropertyInfo result;

            if (!this.childInfos.TryGetValue(childIndex, out result))
            {
                result = InspectorPropertyInfo.CreateValue(
                    name: CollectionResolverUtilities.DefaultIndexToChildName(childIndex),
                    order: childIndex,
                    serializationBackend: this.Property.BaseValueEntry.SerializationBackend,
                    getterSetter: new GetterSetter <TCollection, TElement>(
                        getter: (ref TCollection collection) => this.GetElement(collection, childIndex),
                        setter: (ref TCollection collection, TElement element) => this.SetElement(collection, element, childIndex)),
                    attributes: this.Property.Attributes.Where(attr => !attr.GetType().IsDefined(typeof(DontApplyToListElementsAttribute), true)).ToArray());

                this.childInfos[childIndex] = result;
            }

            return(result);
        }
        public override InspectorPropertyInfo GetChildInfo(int childIndex)
        {
            this.EnsureUpdated();

            InspectorPropertyInfo result;

            if (!this.childInfos.TryGetValue(childIndex, out result))
            {
                result = InspectorPropertyInfo.CreateValue(
                    name: CollectionResolverUtilities.DefaultIndexToChildName(childIndex),
                    order: childIndex,
                    serializationBackend: this.Property.BaseValueEntry.SerializationBackend,
                    getterSetter: new GetterSetter <TDictionary, EditableKeyValuePair <TKey, TValue> >(
                        getter: this.CreateGetter(childIndex),
                        setter: this.CreateSetter(childIndex)),
                    attributes: this.Property.Attributes);

                this.childInfos[childIndex] = result;
            }

            return(result);
        }