Пример #1
0
        /// <summary>
        /// Copies the ReferenceLinks to another ReferenceLinks and secures using the specified object.
        /// </summary>
        /// <param name="target"></param>
        public void CopyTo(ReferenceLinks target, ISecuredObject securedObject)
        {
            ArgumentUtility.CheckForNull(target, nameof(target));

            foreach (var link in this.Links)
            {
                if (link.Value is IList <ReferenceLink> )
                {
                    var hrefs = link.Value as IList <ReferenceLink>;
                    if (hrefs != null)
                    {
                        foreach (var href in hrefs)
                        {
                            target.AddLink(link.Key, href.Href, securedObject);
                        }
                    }
                }
                else if (link.Value is ReferenceLink)
                {
                    var href = link.Value as ReferenceLink;
                    if (href != null)
                    {
                        target.AddLink(link.Key, href.Href, securedObject);
                    }
                }
            }
        }
Пример #2
0
        /// <summary>
        /// Creates a deep copy of the ReferenceLinks.
        /// </summary>
        /// <returns>A deep copy of the ReferenceLinks</returns>
        public ReferenceLinks Clone()
        {
            ReferenceLinks linksCloned = new ReferenceLinks();

            this.CopyTo(linksCloned);
            return(linksCloned);
        }
Пример #3
0
 /// <summary>
 /// Copies the ReferenceLinks to another ReferenceLinks.
 /// </summary>
 /// <param name="target"></param>
 public void CopyTo(ReferenceLinks target)
 {
     CopyTo(target, null);
 }