⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 classcollection.format

📁 客户关系管理系统ASP.NET+VB.NET编程完整程序!
💻 FORMAT
字号:
		/// <summary>
		///	Holds a collection of {0}s that can be searched and enumerated.
		/// </summary>
		[OrmLib.TypedCollection(typeof({0}))]
		public abstract class {0}CollectionOrmTemplate : OrmLib.CollectionTemplate
		{
			/// <summary>
			/// Default constructor.
			/// </summary>
			public {0}CollectionOrmTemplate() : base(typeof({0})){}

			/// <summary>
			/// Gets or sets the <see cref="{0}"/> at the specified index.
			/// In C#, this property is the indexer for the IList interface.
			/// </summary>
			public {0} this[int index]
			{
				get
				{
					return ({0})List[index];
				}
				set
				{
					throw new System.NotSupportedException("Please use the Add() method."); 
				} 
			}	

			/// <summary>
			/// Filter by the provided property name
			/// </summary>
			/// <param name="property">The property to filter on</param>
			/// <param name="searchValue">The value to search for</param>
			/// <returns>A collection of {0}s</returns>
			public {0}Collection FilterBy( string property, object searchValue )
			{
				return FilterBy(property, searchValue, OrmLib.CompareType.Exact);
			}

			/// <summary>
			/// Filter by the provided property name
			/// </summary>
			/// <param name="property">The property to filter on</param>
			/// <param name="searchValue">The value to search for</param>
			/// <param name="comparer">How to compare the property to the search value</param>
			/// <returns>A collection of {0}s</returns>
			public {0}Collection FilterBy( string property, object searchValue, OrmLib.CompareType comparer )
			{
				{0}Collection retCollection = new {0}Collection();
				
				foreach( {0} _{0} in List)
				{
					if ( Match(comparer,_{0}[property] , searchValue) ) 
						retCollection.Add( _{0} );
				}
			
				return retCollection;
			}

			/// <summary>
			/// Returns a sorted collection based on the supplied property name.
			/// </summary>
			/// <param name="property">The property to sort by</param>
			/// <returns></returns>
			public {0}Collection SortBy( string property )
			{
				return SortBy( property, OrmLib.SortDirection.Ascending );
			}

			/// <summary>
			/// Returns a sorted collection based on the supplied property name.
			/// </summary>
			/// <param name="property">The property to sort by</param>
			/// <param name="sortDirection"></param>
			/// <returns></returns>
			public {0}Collection SortBy( string property, OrmLib.SortDirection sortDirection )
			{
				InnerList.Sort( new OrmLib.ObjectPropertyComparer(property));
				if (sortDirection == OrmLib.SortDirection.Descending) InnerList.Reverse();
				return ({0}Collection)this;
			}

		
			/// <summary>
			/// Find the first in the collection, based on the
			/// supplied property.
			/// </summary>
			/// <param name="property">The property to find by</param>
			/// <param name="searchValue"></param>
			/// <returns></returns>
			public {0} FindBy( string property, object searchValue )
			{
				return FindBy(property, searchValue, OrmLib.CompareType.Exact);
			}

			/// <summary>
			/// Find the first in the collection, based on the
			/// supplied property.
			/// </summary>
			/// <param name="property">The property to find by</param>
			/// <param name="searchValue"></param>
			/// <param name="comparer"></param>
			/// <returns></returns>
			public {0} FindBy( string property, object searchValue, OrmLib.CompareType comparer )
			{				
				foreach( {0} _{0} in List)
				{
					if ( Match(comparer,_{0}[property] , searchValue) ) 
						return _{0};
				}
			
				return null;
			}
			
			/// <summary>
			/// Adds a {0} to the collection.
			/// </summary>
			/// <param name="new{0}">Adds a {0} to the collection</param>
			public int Add( {0} new{0})
			{
				return List.Add( new{0} );
			}

{1}{2}{3}
		}


⌨️ 快捷键说明

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