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

📄 csharp.wizards.typedcollection.xft

📁 全功能c#编译器
💻 XFT
字号:
<?xml version="1.0"?>
<Template author="Mike Krueger" version="1.0">
	
	<Config
		name        = "${res:Templates.File.TypedCollection.Name}"
		icon        = "C#.File.FullFile"
		category    = "C#"
		defaultname = "TypedCollection${Number}.cs"
		language    = "C#"
	/>
	 
	<Description>${res:Templates.File.TypedCollection.Description}</Description>

	<Properties>
		<Property
			name        = "ItemType"
			localizedName = "${res:Templates.File.Properties.TypedCollectionWizard.ItemType}"
			type        = "System.String"
			category    = "${res:Templates.File.Properties.ContextCategory}"
			description = "${res:Templates.File.Properties.TypedCollectionWizard.ItemType.Description}"
		/>
		<Property
			name          = "Accessibility"
			localizedName = "${res:Templates.File.Properties.Accessibility}"
			type          = "Types:Accessibility"
			category      = "${res:Templates.File.Properties.OptionCategory}"
			defaultValue  = "public"
			description   = "${res:Templates.File.Properties.Accessibility.Description}"
		/>
		<Property
			name          = "GenerateDocumentation"
			localizedName = "${res:Templates.File.Properties.GenerateDocumentation}"
			type          = "System.Boolean"
			category      = "${res:Templates.File.Properties.OptionCategory}"
			defaultValue  = "True"
			description   = "${res:Templates.File.Properties.GenerateDocumentation}"
		/>
	</Properties>
	
	<Types>
		<Type name = "Accessibility">
			<Enum name = "Public" value = "public"/>
			<Enum name = "Protected" value = "protected"/>
			<Enum name = "Private" value = "private"/>
			<Enum name = "Internal" value = "internal"/>
			<Enum name = "Protected Internal" value = "protected internal"/>
			<Enum name = "Internal Protected" value = "internal protected"/>
		</Type>
	</Types>
	
	<!-- 
	Special new file templates:
		${StandardNamespace}        -> Standardnamespace of the current project or FileNameWithoutExtension
		${FullName}                 -> Full generated path name
		${FileName}                 -> File name with extension
		${FileNameWithoutExtension} -> File name without extension
		${Extension}                -> Extension in the form ".cs"
		${Path}                     -> Full path of the file
	 -->
	<Files>
		<File name="${FullName}" language="C#"><![CDATA[${StandardHeader.C#}

using System;
using System.Collections;

namespace ${StandardNamespace}
{
<%if (GenerateDocumentation) {%>	/// <summary>
	///     <para>
	///       A collection that stores <see cref='.${Properties.ItemType}'/> objects.
	///    </para>
	/// </summary>
	/// <seealso cref='.${FileNameWithoutExtension}'/>
<%}%>	[Serializable()]
	${Properties.Accessibility} class ${FileNameWithoutExtension} : CollectionBase {
		
<%if (GenerateDocumentation) {%>		/// <summary>
		///     <para>
		///       Initializes a new instance of <see cref='.${FileNameWithoutExtension}'/>.
		///    </para>
		/// </summary>
<%}%>		public ${FileNameWithoutExtension}()
		{
		}
		
<%if (GenerateDocumentation) {%>		/// <summary>
		///     <para>
		///       Initializes a new instance of <see cref='.${FileNameWithoutExtension}'/> based on another <see cref='.${FileNameWithoutExtension}'/>.
		///    </para>
		/// </summary>
		/// <param name='value'>
		///       A <see cref='.${FileNameWithoutExtension}'/> from which the contents are copied
		/// </param>
<%}%>		public ${FileNameWithoutExtension}(${FileNameWithoutExtension} val)
		{
			this.AddRange(val);
		}
		
<%if (GenerateDocumentation) {%>		/// <summary>
		///     <para>
		///       Initializes a new instance of <see cref='.${FileNameWithoutExtension}'/> containing any array of <see cref='.${Properties.ItemType}'/> objects.
		///    </para>
		/// </summary>
		/// <param name='value'>
		///       A array of <see cref='.${Properties.ItemType}'/> objects with which to intialize the collection
		/// </param>
<%}%>		public ${FileNameWithoutExtension}(${Properties.ItemType}[] val)
		{
			this.AddRange(val);
		}
		
<%if (GenerateDocumentation) {%>		/// <summary>
		/// <para>Represents the entry at the specified index of the <see cref='.${Properties.ItemType}'/>.</para>
		/// </summary>
		/// <param name='index'><para>The zero-based index of the entry to locate in the collection.</para></param>
		/// <value>
		///    <para> The entry at the specified index of the collection.</para>
		/// </value>
		/// <exception cref='System.ArgumentOutOfRangeException'><paramref name='index'/> is outside the valid range of indexes for the collection.</exception>
<%}%>		public ${Properties.ItemType} this[int index] {
			get {
				return ((${Properties.ItemType})(List[index]));
			}
			set {
				List[index] = value;
			}
		}
		
<%if (GenerateDocumentation) {%>		/// <summary>
		///    <para>Adds a <see cref='.${Properties.ItemType}'/> with the specified value to the 
		///    <see cref='.${FileNameWithoutExtension}'/> .</para>
		/// </summary>
		/// <param name='value'>The <see cref='.${Properties.ItemType}'/> to add.</param>
		/// <returns>
		///    <para>The index at which the new element was inserted.</para>
		/// </returns>
		/// <seealso cref='.${FileNameWithoutExtension}.AddRange'/>
<%}%>		public int Add(${Properties.ItemType} val)
		{
			return List.Add(val);
		}
		
<%if (GenerateDocumentation) {%>		/// <summary>
		/// <para>Copies the elements of an array to the end of the <see cref='.${FileNameWithoutExtension}'/>.</para>
		/// </summary>
		/// <param name='value'>
		///    An array of type <see cref='.${Properties.ItemType}'/> containing the objects to add to the collection.
		/// </param>
		/// <returns>
		///   <para>None.</para>
		/// </returns>
		/// <seealso cref='.${FileNameWithoutExtension}.Add'/>
<%}%>		public void AddRange(${Properties.ItemType}[] val)
		{
			for (int i = 0; i < val.Length; i++) {
				this.Add(val[i]);
			}
		}
		
<%if (GenerateDocumentation) {%>		/// <summary>
		///     <para>
		///       Adds the contents of another <see cref='.${FileNameWithoutExtension}'/> to the end of the collection.
		///    </para>
		/// </summary>
		/// <param name='value'>
		///    A <see cref='.${FileNameWithoutExtension}'/> containing the objects to add to the collection.
		/// </param>
		/// <returns>
		///   <para>None.</para>
		/// </returns>
		/// <seealso cref='.${FileNameWithoutExtension}.Add'/>
<%}%>		public void AddRange(${FileNameWithoutExtension} val)
		{
			for (int i = 0; i < val.Count; i++)
			{
				this.Add(val[i]);
			}
		}
		
<%if (GenerateDocumentation) {%>		/// <summary>
		/// <para>Gets a value indicating whether the 
		///    <see cref='.${FileNameWithoutExtension}'/> contains the specified <see cref='.${Properties.ItemType}'/>.</para>
		/// </summary>
		/// <param name='value'>The <see cref='.${Properties.ItemType}'/> to locate.</param>
		/// <returns>
		/// <para><see langword='true'/> if the <see cref='.${Properties.ItemType}'/> is contained in the collection; 
		///   otherwise, <see langword='false'/>.</para>
		/// </returns>
		/// <seealso cref='.${FileNameWithoutExtension}.IndexOf'/>
<%}%>		public bool Contains(${Properties.ItemType} val)
		{
			return List.Contains(val);
		}
		
<%if (GenerateDocumentation) {%>		/// <summary>
		/// <para>Copies the <see cref='.${FileNameWithoutExtension}'/> values to a one-dimensional <see cref='System.Array'/> instance at the 
		///    specified index.</para>
		/// </summary>
		/// <param name='array'><para>The one-dimensional <see cref='System.Array'/> that is the destination of the values copied from <see cref='.${FileNameWithoutExtension}'/> .</para></param>
		/// <param name='index'>The index in <paramref name='array'/> where copying begins.</param>
		/// <returns>
		///   <para>None.</para>
		/// </returns>
		/// <exception cref='System.ArgumentException'><para><paramref name='array'/> is multidimensional.</para> <para>-or-</para> <para>The number of elements in the <see cref='.${FileNameWithoutExtension}'/> is greater than the available space between <paramref name='arrayIndex'/> and the end of <paramref name='array'/>.</para></exception>
		/// <exception cref='System.ArgumentNullException'><paramref name='array'/> is <see langword='null'/>. </exception>
		/// <exception cref='System.ArgumentOutOfRangeException'><paramref name='arrayIndex'/> is less than <paramref name='array'/>'s lowbound. </exception>
		/// <seealso cref='System.Array'/>
<%}%>		public void CopyTo(${Properties.ItemType}[] array, int index)
		{
			List.CopyTo(array, index);
		}
		
<%if (GenerateDocumentation) {%>		/// <summary>
		///    <para>Returns the index of a <see cref='.${Properties.ItemType}'/> in 
		///       the <see cref='.${FileNameWithoutExtension}'/> .</para>
		/// </summary>
		/// <param name='value'>The <see cref='.${Properties.ItemType}'/> to locate.</param>
		/// <returns>
		/// <para>The index of the <see cref='.${Properties.ItemType}'/> of <paramref name='value'/> in the 
		/// <see cref='.${FileNameWithoutExtension}'/>, if found; otherwise, -1.</para>
		/// </returns>
		/// <seealso cref='.${FileNameWithoutExtension}.Contains'/>
<%}%>		public int IndexOf(${Properties.ItemType} val)
		{
			return List.IndexOf(val);
		}
		
<%if (GenerateDocumentation) {%>		/// <summary>
		/// <para>Inserts a <see cref='.${Properties.ItemType}'/> into the <see cref='.${FileNameWithoutExtension}'/> at the specified index.</para>
		/// </summary>
		/// <param name='index'>The zero-based index where <paramref name='value'/> should be inserted.</param>
		/// <param name=' value'>The <see cref='.${Properties.ItemType}'/> to insert.</param>
		/// <returns><para>None.</para></returns>
		/// <seealso cref='.${FileNameWithoutExtension}.Add'/>
<%}%>		public void Insert(int index, ${Properties.ItemType} val)
		{
			List.Insert(index, val);
		}
		
<%if (GenerateDocumentation) {%>		/// <summary>
		///    <para>Returns an enumerator that can iterate through 
		///       the <see cref='.${FileNameWithoutExtension}'/> .</para>
		/// </summary>
		/// <returns><para>None.</para></returns>
		/// <seealso cref='System.Collections.IEnumerator'/>
<%}%>		public new ${Properties.ItemType}Enumerator GetEnumerator()
		{
			return new ${Properties.ItemType}Enumerator(this);
		}
		
<%if (GenerateDocumentation) {%>		/// <summary>
		///    <para> Removes a specific <see cref='.${Properties.ItemType}'/> from the 
		///    <see cref='.${FileNameWithoutExtension}'/> .</para>
		/// </summary>
		/// <param name='value'>The <see cref='.${Properties.ItemType}'/> to remove from the <see cref='.${FileNameWithoutExtension}'/> .</param>
		/// <returns><para>None.</para></returns>
		/// <exception cref='System.ArgumentException'><paramref name='value'/> is not found in the Collection. </exception>
<%}%>		public void Remove(${Properties.ItemType} val)
		{
			List.Remove(val);
		}
		
		public class ${Properties.ItemType}Enumerator : IEnumerator
		{
			IEnumerator baseEnumerator;
			IEnumerable temp;
			
			public ${Properties.ItemType}Enumerator(${FileNameWithoutExtension} mappings)
			{
				this.temp = ((IEnumerable)(mappings));
				this.baseEnumerator = temp.GetEnumerator();
			}
			
			public ${Properties.ItemType} Current {
				get {
					return ((${Properties.ItemType})(baseEnumerator.Current));
				}
			}
			
			object IEnumerator.Current {
				get {
					return baseEnumerator.Current;
				}
			}
			
			public bool MoveNext()
			{
				return baseEnumerator.MoveNext();
			}
			
			bool IEnumerator.MoveNext()
			{
				return baseEnumerator.MoveNext();
			}
			
			public void Reset()
			{
				baseEnumerator.Reset();
			}
			
			void IEnumerator.Reset()
			{
				baseEnumerator.Reset();
			}
		}
	}
}]]></File>
	</Files>
	
	<AdditionalOptions/>
</Template>

⌨️ 快捷键说明

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