This project is read-only.
Project Description
A collection of parameterized C# code snippets.

Features
  • arglistX makes an argument list with X elements
  • arrayX makes a 1D array with X elements
  • arrayXbyY makes a 2D array with X×Y elements
  • forCX creates X inset for loops with the outer indexer starting at the letter C
  • parrX adds code to run X tasks in parallel (uses AutoResetEvent), but Parallel.Invoke also works :)
  • catchX adds code to run X different types of exception
  • flagsX creates a [Flags] enum with X flags
  • getflagsX tests for X flags in an enum, and creates X boolean variables
  • powX creates an inline calculation equivalent to Math.Pow(_your code_, X)
  • polyiX and polypX creates a function to compute a polynomial with highest order X (the -p version uses Math.Pow(), the -i version uses inline multiplication
  • varlistX declares X variables (variable names starting with 'a') in a single line of code
  • fsmX creates a finite state machine with X states (this includes declaration of the fsm enum, creation of Before- and After- EventArgs classes, and the creation of the state machine itself; many elements are optional and can be safely removed)
  • subX and supX are ways to insert subscript and superscript digits (as well as the +, -, =, ( and ) symbols) into your code. They have only been tested with Consolas font, so if you use another font, it probably won't work. Subscripts and superscripts cannot be used as identifiers, but can appear in comments.
  • Entity classes:
    • tupleXsimple makes a tuple class with X elements (e.g., Pair<T1, T2>)
    • entityXauto creates a class with X auto-properties
    • arrstoreX generates an array-based storage class with X elements
    • dpentityXbyY creates a DependencyProperty-based entity class with X read-write properties and Y read-only properties
    • entityXslim creates a class with X properties whose read and write behavior is regulated with ReaderWriterLockSlim. Note: requires .NET 3.5

Keywords: snippets, code generation, generative, arity, degree of freedom

Question: did you find these snippets useful? Did you do something fun with them? Did they make you hate me and the code snippet technology? Leave a comment below.

Last edited Oct 25, 2010 at 9:53 AM by nesteruk, version 24