1, WindowsLiveWriter.CNBlogs.CodeHighlighter
//<summary> /// traversing elements
/// </summary> /// <typeparam name= "T" ></typeparam> /// <param name= "source" ></param> /// <param name= "action" ></param> /// <returns></returns> Public StaticIenumerable<t> foreach<t> ( ThisIenumerable<t> Source, action<t>action) { if(Source = =NULL) { Throw NewArgumentNullException ("Source"); } if(Action = =NULL) { Throw NewArgumentNullException ("Action"); } foreach(varIteminchsource) {action (item); yield returnitem; } }
2. Windows Live Writer Source Code plugin for Syntaxhighlighter
<summary>///the collection fragment//Specifies the length of each segment range///</summary>///<typeparam name= "T" ></typeparam>/// <param name= "source" ></param>///<param name= "Rangelength" ></param>///<returns>< /returns>public static ienumerable<ienumerable<t>> subparagraph<t> (This IEnumerable<T> source, int rangelength) {if (Rangelength < 1) {throw new Exception ("Rangelength parameter should be greater than or equal to 1");} if (Source = = null) {throw new ArgumentNullException ("source");} var temp = Source;while (!temp. IsEmpty ()) {yield return temp. Take (rangelength); temp = temp. Skip (Rangelength);}}
Test Windows Live Writer