コード例 #1
0
ファイル: Album.cs プロジェクト: KuduApps/GalleryServerPro
        /// <summary>
        /// Removes the specified gallery object from the collection of child objects
        /// of this gallery object.
        /// </summary>
        /// <param name="galleryObject">The <see cref="IGalleryObject" /> to remove as a child of this
        /// gallery object.</param>
        /// <exception cref="System.NotSupportedException">Thrown when an inherited type
        /// does not allow the addition of child gallery objects.</exception>
        /// <exception cref="System.ArgumentException">Thrown when the specified
        /// gallery object is not child of this gallery object.</exception>
        /// <exception cref="ArgumentNullException">Thrown when <paramref name="galleryObject" /> is null.</exception>
        public override void Remove(IGalleryObject galleryObject)
        {
            if (galleryObject == null)
                throw new ArgumentNullException("galleryObject");

            if (!this._galleryObjects.Contains(galleryObject))
                throw new ArgumentException(String.Format(CultureInfo.CurrentCulture, Resources.Album_Remove_Ex_Msg, this.Id, galleryObject.Id, galleryObject.Parent.Id));

            galleryObject.SetParentToNullObject();

            lock (this._galleryObjects)
            {
                this._galleryObjects.Remove(galleryObject);
            }
        }