Text Clips for Programmers Notepad 2 (C#)
Edit (30 Sep 2005): ASP.NET Snippets and Miscellaneous Snippets (properties) added.
More Text Clips for Programmers Notepad 2. Useful for when working with C#.
Create a file in the clips sub directory of the Programmers Notepad directory, with the extension .clips (i.e. csclips.clips) and paste in the following code:
<?xml version="1.0"?> <clips name="C# Clips"> <clip name="------ Exception handling ------"></clip> <clip name="throw"><![CDATA[throw(new |Exception());]]></clip> <clip name="try-catch"><![CDATA[try { | } catch(Exception e) { }]]></clip> <clip name="try-finally"><![CDATA[try { | } finally { }]]></clip> <clip name="try-catch-finally"><![CDATA[try { | } catch(Exception e) { } finally { }]]></clip> <clip name="------ Iteration ------"></clip> <clip name="do"><![CDATA[do { } while(|);]]></clip> <clip name="for"><![CDATA[for (int i = 0; i <= |; i++) { }]]></clip> <clip name="foreach"><![CDATA[foreach (int i in |) { }]]></clip> <clip name="while"><![CDATA[while(|) { }]]></clip> <clip name="------ Reference type declaration ------"></clip> <clip name="class"><![CDATA[public class | { }]]></clip> <clip name="delegate"><![CDATA[delegate void |();]]></clip> <clip name="delegate (event handling)"><![CDATA[public delegate void |ChangedEventHandler(); public event ChangedEventHandler Changed; protected virtual void OnChanged() { if (Changed != null) { Changed(); } }]]></clip> <clip name="interface"><![CDATA[public interface I| { }]]></clip> <clip name="------ Selection ------"></clip> <clip name="?:"><![CDATA[| = (bar == baz) ? footrue : foofalse]]></clip> <clip name="if"><![CDATA[if(|) { }]]></clip> <clip name="if-else"><![CDATA[if(|) { } else { }]]></clip> <clip name="if-else if"><![CDATA[if(|) { } else if() { }]]></clip> <clip name="switch case"><![CDATA[switch(|) { case 1: break; default: break; }]]></clip> <clip name="------ Documentation Comments ------"></clip> <clip name="/// "><![CDATA[///|]]></clip> <clip name="<c> (inline code)"><![CDATA[<c>|</c>]]></clip> <clip name="<code> (multiline code)"><![CDATA[/// <code> /// | /// </code>]]></clip> <clip name="<example> (method example)"><![CDATA[/// <example> /// | /// </example>]]></clip> <clip name="<example> (method example, includes <code>)"><![CDATA[/// <example> /// <code> /// | /// </code> /// </example>]]></clip> <clip name="<exception>"><![CDATA[/// <exception cref="System.Exception">Thrown when... |.</exception>]]></clip> <clip name="<include>"><![CDATA[//// <include file='|.xml' path='MyDocs/MyMembers[@name="test"]/*' />]]></clip> <clip name="<list> (bullet, with items)"><![CDATA[/// <list type="bullet"> /// <listheader> /// <term>List Header</term> /// <description>|.</description> /// </listheader> /// <item> /// <term>Term 1</term> /// <description>Item 1.</description> /// </item> /// <item> /// <term>Term 2</term> /// <description>Item 2.</description> /// </item> /// </list>]]></clip> <clip name="<list> (number, with items)"><![CDATA[/// <list type="number"> /// <listheader> /// <term>List Header</term> /// <description>|.</description> /// </listheader> /// <item> /// <term>Term 1</term> /// <description>Item 1.</description> /// </item> /// <item> /// <term>Term 2</term> /// <description>Item 2.</description> /// </item> /// </list>]]></clip> <clip name="<list> (table, with items)"><![CDATA[/// <list type="table"> /// <listheader> /// <term>List Header</term> /// <description>|.</description> /// </listheader> /// <item> /// <term>Term 1</term> /// <description>Item 1.</description> /// </item> /// <item> /// <term>Term 2</term> /// <description>Item 2.</description> /// </item> /// </list>]]></clip> <clip name="<list> (bullet, without items)"><![CDATA[/// <list type="bullet"> /// | /// </list>]]></clip> <clip name="<list> (number, without items)"><![CDATA[/// <list type="number"> /// | /// </list>]]></clip> <clip name="<list> (table, without items)"><![CDATA[/// <list type="table"> /// | /// </list>]]></clip> <clip name="<list> - <item>"><![CDATA[/// <item> /// <term>List Header</term> /// <description>|.</description> /// </item>]]></clip> <clip name="<list> - <listheader>"><![CDATA[/// <listheader> /// <term>List Header</term> /// <description>|.</description> /// </listheader>]]></clip> <clip name="<para> (paragraph)"><![CDATA[/// <para> /// | /// </para>]]></clip> <clip name="<param> (parameter)"><![CDATA[/// <param name='|'>Description.</param>]]></clip> <clip name="<paramref> (parameter reference)"><![CDATA[<paramref name="|"/>]]></clip> <clip name="<permission>"><![CDATA[/// <permission cref="System.Security.PermissionSet">|.</permission>]]></clip> <clip name="<remarks>"><![CDATA[/// <remarks> /// | /// </remarks>]]></clip> <clip name="<returns>"><![CDATA[/// <returns> /// | /// </returns>]]></clip> <clip name="<see>"><![CDATA[<see cref="|"/>]]></clip> <clip name="<seealso>"><![CDATA[<seealso cref="|"/>]]></clip> <clip name="<summary>"><![CDATA[/// <summary> /// | /// </summary>]]></clip> <clip name="<value>"><![CDATA[/// <value>|.</value>]]></clip> <clip name="------ ASP.NET Snippets ------"></clip> <clip name="Page CodeBehind"><![CDATA[using System; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.HtmlControls; namespace MyNamespace { public class MyPage : Page { #region Web Form Designer generated code override protected void OnInit(EventArgs e) { // // CODEGEN: This call is required by the ASP.NET Web Form Designer. // InitializeComponent(); } /// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { this.Load += new System.EventHandler(this.LoadPage); } #endregion private void LoadPage(object sender, EventArgs e) { | } } }]]></clip> <clip name="UserControl CodeBehind"><![CDATA[using System; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.HtmlControls; namespace MyNamespace { public class MyControl : UserControl { #region Web Form Designer generated code override protected void OnInit(EventArgs e) { // // CODEGEN: This call is required by the ASP.NET Web Form Designer. // InitializeComponent(); } /// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { this.Load += new System.EventHandler(this.LoadUserControl); } #endregion private void LoadUserControl(object sender, EventArgs e) { | } } }]]></clip> <clip name="WebHandler"><![CDATA[<%@ WebHandler Language="C#" Class="MyNamespace.MyHandler" %> using System; using System.IO; using System.Web; namespace MyNamespace { public class MyHandler: IHttpHandler { public bool IsReusable { get { return true; } } public void ProcessRequest(HttpContext ctx) { ctx.Response.ContentType = "text/plain"; ctx.Response.Write("|"); ctx.Response.End(); } } }]]></clip> <clip name="------ Miscellaneous Snippets ------"></clip> <clip name="Property (bool)"><![CDATA[private bool |myBool; public bool MyBool { get { return myBool; } set { myBool = value; } }]]></clip> <clip name="Property (DateTime)"><![CDATA[private DateTime |myDate; public DateTime MyDate { get { return myDate; } set { myDate = value; } }]]></clip> <clip name="Property (decimal)"><![CDATA[private decimal |myDecimal; public decimal MyDecimal { get { return myDecimal; } set { myDecimal = value; } }]]></clip> <clip name="Property (double)"><![CDATA[private double |myDouble; public double MyDouble { get { return myDouble; } set { myDouble = value; } }]]></clip> <clip name="Property (float)"><![CDATA[private float |myFloat; public float MyFloat { get { return myFloat; } set { myFloat = value; } }]]></clip> <clip name="Property (int)"><![CDATA[private int |myInt; public int MyInt { get { return myInt; } set { myInt = value; } }]]></clip> <clip name="Property (long)"><![CDATA[private long |myLong; public long MyLong { get { return myLong; } set { myLong = value; } }]]></clip> <clip name="Property (short)"><![CDATA[private short |myShort; public short MyShort { get { return myShort; } set { myShort = value; } }]]></clip> <clip name="Property (string)"><![CDATA[private string |myString; public string MyString { get { return myString; } set { myString = value; } }]]></clip> </clips>
Tags: Notepad Alternative, Programmers Notepad, PN2, CSharp
Comments