Exemple #1
0
        public override IEnumerable <Item> ChildrenOfItem(Item item)
        {
            IEnumerable <Item> children = null;

            item = ProxyItem.Unwrap(item);

            if (!SupportedItemTypes.Any(type => type.IsInstanceOfType(item)))
            {
                return(Enumerable.Empty <Item> ());
            }

            try {
                // Strictly evaluate the IEnumerable before we leave the try block.
                children = ItemSource.ChildrenOfItem(item).ToArray();
            } catch (Exception e) {
                children = null;
                SafeElement.LogSafeError(ItemSource, e, "ChildrenOfItem");
            } finally {
                children = children ?? Enumerable.Empty <Item> ();
            }
            return(children);
        }