photos.cs

来自「这是一个小型的相片管理器」· CS 代码 · 共 62 行

CS
62
字号


using System;
using System.Collections;

namespace VirtualPhotoOrganizer.Photo
{
	/// <summary>
	/// the collections class for a Photo
	/// </summary>
	internal class Photos : CollectionBase, ICloneable
	{
		#region public accessors

		public int Add(Photo p) {
			return List.Add(p);
		}

		public void Insert(int index, Photo p) {
			List.Insert(index, p);
		}

		public void Remove(Photo p) {
			List.Remove(p);
		}

		public void RemoveAt(int index) {
			List.RemoveAt(index);
		}

		public bool Contains(Photo p) {
			return List.Contains(p);
		}

		public int IndexOf(Photo p) {
			return List.IndexOf(p);
		}

		public void CopyTo(Photo[] array, int index) {
			List.CopyTo(array, index);
		}

		public Photo this[int index] {
			get { return (Photo) List[index]; }
			set { List[index] = value; }
		}

		#endregion

		#region ICloneable Member

		public object Clone() {
			Photos photos = new Photos();
			foreach (Photo p in this)
				photos.Add(new Photo(p.Path, p.Thumbnail, p.Title, p.Description, p.TimeTaken));
			return photos;
		}

		#endregion
	}
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?