<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://performiq.com/kb/index.php?action=history&amp;feed=atom&amp;title=Dot.NET_Notes</id>
	<title>Dot.NET Notes - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://performiq.com/kb/index.php?action=history&amp;feed=atom&amp;title=Dot.NET_Notes"/>
	<link rel="alternate" type="text/html" href="https://performiq.com/kb/index.php?title=Dot.NET_Notes&amp;action=history"/>
	<updated>2026-05-18T20:46:10Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.37.1</generator>
	<entry>
		<id>https://performiq.com/kb/index.php?title=Dot.NET_Notes&amp;diff=5162&amp;oldid=prev</id>
		<title>PeterHarding at 18:51, 16 October 2021</title>
		<link rel="alternate" type="text/html" href="https://performiq.com/kb/index.php?title=Dot.NET_Notes&amp;diff=5162&amp;oldid=prev"/>
		<updated>2021-10-16T18:51:50Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 04:51, 17 October 2021&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l106&quot;&gt;Line 106:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 106:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;/pre&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;/pre&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;[[Category:C Sharp]]&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;[[Category:Dot.NET]]&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;[[Category:Dot.NET]]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>PeterHarding</name></author>
	</entry>
	<entry>
		<id>https://performiq.com/kb/index.php?title=Dot.NET_Notes&amp;diff=3338&amp;oldid=prev</id>
		<title>PeterHarding: Created page with &#039;=Notes=  * http://www.knowdotnet.com/articles/lambdasandpredicates.html  &lt;pre&gt;         private static void TestFeatureProgression()         {             // Example 1:           ...&#039;</title>
		<link rel="alternate" type="text/html" href="https://performiq.com/kb/index.php?title=Dot.NET_Notes&amp;diff=3338&amp;oldid=prev"/>
		<updated>2010-11-18T11:41:55Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;#039;=Notes=  * http://www.knowdotnet.com/articles/lambdasandpredicates.html  &amp;lt;pre&amp;gt;         private static void TestFeatureProgression()         {             // Example 1:           ...&amp;#039;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;=Notes=&lt;br /&gt;
&lt;br /&gt;
* http://www.knowdotnet.com/articles/lambdasandpredicates.html&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
        private static void TestFeatureProgression()&lt;br /&gt;
        {&lt;br /&gt;
            // Example 1:&lt;br /&gt;
            // Olden days methodolgy for finding odd numbers in an array&lt;br /&gt;
            // back before even Generics were available&lt;br /&gt;
            ArrayList al = new ArrayList(){20, 1, 3, 4, 8, 9, 44, 47 };&lt;br /&gt;
            int[] intList = new int[] {20, 1, 3, 4, 8, 9, 44, 47 };&lt;br /&gt;
            ArrayList oddIntegers = new ArrayList();&lt;br /&gt;
&lt;br /&gt;
            foreach (int i in intList)&lt;br /&gt;
            {&lt;br /&gt;
                if ((i % 2) &amp;gt; 0)&lt;br /&gt;
                {&lt;br /&gt;
                    oddIntegers.Add(i);&lt;br /&gt;
                } // if&lt;br /&gt;
            } // foreach&lt;br /&gt;
&lt;br /&gt;
            DisplayNumbers(oddIntegers, &amp;quot;using an array search&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
            // or since we now have generics, we can jump ahead and&lt;br /&gt;
            // convert the arraylist to a generic list and pass it to&lt;br /&gt;
            // the method that displays a List&amp;lt;&amp;gt;&lt;br /&gt;
            DisplayNumbers(new List&amp;lt;int&amp;gt;(oddIntegers.ToArray(typeof(int)) as int[]),&lt;br /&gt;
                &amp;quot;using array search printed from generic list&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
            // Now, we bring in Generics and their power.  Not only is a&lt;br /&gt;
            // List&amp;lt;int&amp;gt; more powerful than an ArrayList, but it is&lt;br /&gt;
            // strongly typed so that unlike an arraylist, you cannot add&lt;br /&gt;
            // a string to the List&amp;lt;int&amp;gt;.  First we will create a&lt;br /&gt;
            // list of integers with automatic initialization just as we&lt;br /&gt;
            // previously did with the creation of an array.&lt;br /&gt;
            // which will be used by all three examples&lt;br /&gt;
            List&amp;lt;int&amp;gt; list = new List&amp;lt;int&amp;gt;() { 20, 1, 3, 4, 8, 9, 44, 47 };&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
            // Example 2):&lt;br /&gt;
            // first, a Predicate delegate is a reference that returns a bool&lt;br /&gt;
            // note that IsOddNumber is a separate method shown below&lt;br /&gt;
            Predicate&amp;lt;int&amp;gt; callBack = new Predicate&amp;lt;int&amp;gt;(IsOddNumber);&lt;br /&gt;
&lt;br /&gt;
            // now you can pass the Predicate delegate to the FindAll method of the generic List&lt;br /&gt;
            List&amp;lt;int&amp;gt; oddNumbers = list.FindAll(callBack);&lt;br /&gt;
&lt;br /&gt;
            // at this point all even numbers are in the list evenNumbers&lt;br /&gt;
            DisplayNumbers(oddNumbers, &amp;quot;using Predicate delegate&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
            // Example 3):&lt;br /&gt;
            // now shorten code by using an anonymous method&lt;br /&gt;
            // note that we no longer need to declare and use the IsOddNumber method&lt;br /&gt;
            list = list.FindAll(delegate(int i) { return (i % 2) &amp;gt; 0; });&lt;br /&gt;
&lt;br /&gt;
            DisplayNumbers(oddNumbers, &amp;quot;using anonymous method&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
            // Example 4:&lt;br /&gt;
            // a lambda expression can even shorten it more&lt;br /&gt;
            // the =&amp;gt; (lambda) symbol means that the parameter (list) on the left side&lt;br /&gt;
            // of the lambda symbol is to be processed by the expression on the right side&lt;br /&gt;
            // of the lambda symbol.  The expression was originally a formally coded delegate&lt;br /&gt;
            // and in Example 2, it required a method to be the target of the Predicate.&lt;br /&gt;
            // In the second example we shortened the code by the use of an anonymous method&lt;br /&gt;
            // allowing us to do away with the Predicate and its target method (IsOddNumber).&lt;br /&gt;
            // In Example 4 shown below, the FindAll method of the list object will call&lt;br /&gt;
            // the implied anonymous method for each object in the List&amp;lt;int&amp;gt;.&lt;br /&gt;
            // To sum up the following line of code in english:&lt;br /&gt;
            // My list of paramaters &amp;quot;[int] i&amp;quot; will be processed by the expression &amp;quot;(i % 2) &amp;gt; 0&amp;quot;&lt;br /&gt;
            oddNumbers = list.FindAll(i =&amp;gt; (i % 2) &amp;gt; 0);&lt;br /&gt;
&lt;br /&gt;
            DisplayNumbers(oddNumbers, &amp;quot;using a lambda expression&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
            // you could&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        /// target for the Predicate&amp;lt;&amp;gt; delegate&lt;br /&gt;
        static bool IsOddNumber(int i)&lt;br /&gt;
        {&lt;br /&gt;
            // is it an even number?&lt;br /&gt;
            return (i % 2) &amp;gt; 0;&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        private static void DisplayNumbers(ArrayList oddNumbers, string s)&lt;br /&gt;
        {&lt;br /&gt;
            Console.WriteLine(&amp;quot;Here are your odd numbers &amp;quot; + s);&lt;br /&gt;
            foreach (int oddNumber in oddNumbers)&lt;br /&gt;
            {&lt;br /&gt;
                Console.Write(&amp;quot;{0}\t&amp;quot;, oddNumber);&lt;br /&gt;
            } // foreach&lt;br /&gt;
            Console.WriteLine(Environment.NewLine + Environment.NewLine);&lt;br /&gt;
        } // method: DisplayNumbers&lt;br /&gt;
&lt;br /&gt;
        private static void DisplayNumbers(List&amp;lt;int&amp;gt; oddNumbers, string s)&lt;br /&gt;
        {&lt;br /&gt;
            Console.WriteLine(&amp;quot;Here are your odd numbers &amp;quot; + s);&lt;br /&gt;
            foreach (int oddNumber in oddNumbers)&lt;br /&gt;
            {&lt;br /&gt;
                Console.Write(&amp;quot;{0}\t&amp;quot;, oddNumber);&lt;br /&gt;
            } // foreach&lt;br /&gt;
            Console.WriteLine(Environment.NewLine + Environment.NewLine);&lt;br /&gt;
        }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Dot.NET]]&lt;/div&gt;</summary>
		<author><name>PeterHarding</name></author>
	</entry>
</feed>