예제 #1
0
        static internal Collection <SyndicationPerson> ClonePersons(Collection <SyndicationPerson> persons)
        {
            if (persons == null)
            {
                return(null);
            }
            Collection <SyndicationPerson> result = new NullNotAllowedCollection <SyndicationPerson>();

            for (int i = 0; i < persons.Count; ++i)
            {
                result.Add(persons[i].Clone());
            }
            return(result);
        }
예제 #2
0
        static internal Collection <SyndicationCategory> CloneCategories(Collection <SyndicationCategory> categories)
        {
            if (categories == null)
            {
                return(null);
            }
            Collection <SyndicationCategory> result = new NullNotAllowedCollection <SyndicationCategory>();

            for (int i = 0; i < categories.Count; ++i)
            {
                result.Add(categories[i].Clone());
            }
            return(result);
        }
예제 #3
0
        static internal Collection <SyndicationLink> CloneLinks(Collection <SyndicationLink> links)
        {
            if (links == null)
            {
                return(null);
            }
            Collection <SyndicationLink> result = new NullNotAllowedCollection <SyndicationLink>();

            for (int i = 0; i < links.Count; ++i)
            {
                result.Add(links[i].Clone());
            }
            return(result);
        }
예제 #4
0
        protected SyndicationFeed(SyndicationFeed source, bool cloneItems)
        {
            if (source == null)
            {
                throw new ArgumentNullException(nameof(source));
            }
            _authors         = FeedUtils.ClonePersons(source._authors);
            _categories      = FeedUtils.CloneCategories(source._categories);
            _contributors    = FeedUtils.ClonePersons(source._contributors);
            _copyright       = FeedUtils.CloneTextContent(source._copyright);
            _description     = FeedUtils.CloneTextContent(source._description);
            _extensions      = source._extensions.Clone();
            _generator       = source._generator;
            _id              = source._id;
            _imageUrl        = source._imageUrl;
            _language        = source._language;
            _lastUpdatedTime = source._lastUpdatedTime;
            _links           = FeedUtils.CloneLinks(source._links);
            _title           = FeedUtils.CloneTextContent(source._title);
            _baseUri         = source._baseUri;
            IList <SyndicationItem> srcList = source._items as IList <SyndicationItem>;

            if (srcList != null)
            {
                Collection <SyndicationItem> tmp = new NullNotAllowedCollection <SyndicationItem>();
                for (int i = 0; i < srcList.Count; ++i)
                {
                    tmp.Add((cloneItems) ? srcList[i].Clone() : srcList[i]);
                }
                _items = tmp;
            }
            else
            {
                if (cloneItems)
                {
                    throw new InvalidOperationException(SR.UnbufferedItemsCannotBeCloned);
                }
                _items = source._items;
            }
        }