uploadfilecollection.cs

来自「上传的控件」· CS 代码 · 共 120 行

CS
120
字号
#region License

/*
* SunriseUpload - Asp.net Upload Component
*
* Copyright (C) 2004 mic <mic4free@hotmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
*
* In case your copy of SunriseUpload does not include a copy of the license, you may find it online at 
* http://www.gnu.org/copyleft/gpl.html
*
* You can find new release of this component at http://athena.9966.org/SunriseUpload .
*/

#endregion

using System;
using System.Collections;

namespace WUSGControl.Web.Upload
{
	/// <summary>
	/// A simple collection class of upload file
	/// </summary>
	public class UploadFileCollection : ICollection, IEnumerable
	{
		#region Fields

		private ArrayList filelist;

		#endregion

		#region Properties

        /// <summary>
        /// 正在上传文件的数量,一个选择了文件的文件选择框在上传时算作一个
        /// </summary>
		public int Count
		{
			get { return this.filelist.Count; }
		}

		#endregion

		#region Methods
        /// <summary>
        /// 是否同步对文件列表的访问. 
        /// </summary>
		public bool IsSynchronized
		{
			get { return this.filelist.IsSynchronized; }
		}
        /// <summary>
        /// 上传文件的索引访问
        /// </summary>
        /// <param name="index"></param>
        /// <returns></returns>
		public UploadFile this[int index]
		{
			get { return ((UploadFile) this.filelist[index]); }
		}
        /// <summary>
        /// 获取可用于同步 System.Collections.ArrayList 访问的对象
        /// </summary>
		public object SyncRoot
		{
			get { return this.filelist.SyncRoot; }
		}
        /// <summary>
        /// 构造方法,生成一个文件数组
        /// </summary>
		public UploadFileCollection()
		{
			this.filelist = new ArrayList();
		}

        /// <summary>
        /// 增加一个上传文件
        /// </summary>
        /// <param name="File"></param>
		public void Add(UploadFile File)
		{
			this.filelist.Add(File);
		}
        /// <summary>
        /// 拷贝array到this.filelist
        /// </summary>
        /// <param name="array"></param>
        /// <param name="index"></param>
		public void CopyTo(Array array, int index)
		{
			this.filelist.CopyTo(array, index);
		}

        /// <summary>
        /// 获取枚举器
        /// </summary>
        /// <returns></returns>
		public IEnumerator GetEnumerator()
		{
			return this.filelist.GetEnumerator();
		}

		#endregion
	}

}

⌨️ 快捷键说明

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