示例#1
0
        public TProperty TryGetAssociatedItemProperty <TProperty>(uint itemId) where TProperty : class, IItemProperty
        {
            if (typeof(TProperty).IsAbstract)
            {
                ExceptionUtil.ThrowInvalidOperationException($"Cannot call this method with an abstract type, type: { typeof(TProperty).Name }.");
            }

            ItemPropertiesBox itemPropertiesBox = this.metaBox.ItemProperties;
            IReadOnlyList <ItemPropertyAssociationEntry> items = itemPropertiesBox.TryGetAssociatedProperties(itemId);

            if (items != null)
            {
                for (int i = 0; i < items.Count; i++)
                {
                    IItemProperty property = itemPropertiesBox.TryGetProperty(items[i].PropertyIndex);

                    if (property is TProperty requestedProperty)
                    {
                        return(requestedProperty);
                    }
                }
            }

            return(null);
        }
            public bool MoveNext()
            {
                CompressedAV1ImageCollection localItems = this.items;

                if (localItems.version == this.version && (uint)this.index < (uint)localItems.Count)
                {
                    this.Current = localItems[this.index];
                    this.index++;

                    return(true);
                }
                else
                {
                    if (localItems.version != this.version)
                    {
                        ExceptionUtil.ThrowInvalidOperationException("The collection was modified while enumerating.");
                    }

                    this.index   = localItems.Count;
                    this.Current = default;

                    return(false);
                }
            }