コード例 #1
0
        public bool HasAncestor(Folder ancestor)
        {
            if (ancestor == null)
            {
                throw new ArgumentNullException("ancestor");
            }

            if (device != ancestor.device)
            {
                throw new ArgumentException("Folders are on different devices");
            }

            bool hasAncestor = false;

            if (parentId != 0)
            {
                if (parentId == ancestor.FolderId)
                {
                    hasAncestor = true;
                }
                else
                {
                    Folder parent = CreateParentFolder();

                    hasAncestor = parent.HasAncestor(ancestor);
                }
            }
            return(hasAncestor);
        }