<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="ru">
		<id>http://nfex.ru/index.php?action=history&amp;feed=atom&amp;title=Csharp%2FCSharp_Tutorial%2FLINQ%2FFunc</id>
		<title>Csharp/CSharp Tutorial/LINQ/Func - История изменений</title>
		<link rel="self" type="application/atom+xml" href="http://nfex.ru/index.php?action=history&amp;feed=atom&amp;title=Csharp%2FCSharp_Tutorial%2FLINQ%2FFunc"/>
		<link rel="alternate" type="text/html" href="http://nfex.ru/index.php?title=Csharp/CSharp_Tutorial/LINQ/Func&amp;action=history"/>
		<updated>2026-04-30T09:52:53Z</updated>
		<subtitle>История изменений этой страницы в вики</subtitle>
		<generator>MediaWiki 1.30.0</generator>

	<entry>
		<id>http://nfex.ru/index.php?title=Csharp/CSharp_Tutorial/LINQ/Func&amp;diff=6138&amp;oldid=prev</id>
		<title> в 15:31, 26 мая 2010</title>
		<link rel="alternate" type="text/html" href="http://nfex.ru/index.php?title=Csharp/CSharp_Tutorial/LINQ/Func&amp;diff=6138&amp;oldid=prev"/>
				<updated>2010-05-26T15:31:53Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr style=&quot;vertical-align: top;&quot; lang=&quot;ru&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Предыдущая&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Версия 15:31, 26 мая 2010&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; style=&quot;text-align: center;&quot; lang=&quot;ru&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(нет различий)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
			</entry>

	<entry>
		<id>http://nfex.ru/index.php?title=Csharp/CSharp_Tutorial/LINQ/Func&amp;diff=6139&amp;oldid=prev</id>
		<title>Admin: 1 версия</title>
		<link rel="alternate" type="text/html" href="http://nfex.ru/index.php?title=Csharp/CSharp_Tutorial/LINQ/Func&amp;diff=6139&amp;oldid=prev"/>
				<updated>2010-05-26T12:18:21Z</updated>
		
		<summary type="html">&lt;p&gt;1 версия&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Новая страница&lt;/b&gt;&lt;/p&gt;&lt;div&gt;==Accumulator function==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;using System;&lt;br /&gt;
using System.Collections.Generic;&lt;br /&gt;
using System.Linq;&lt;br /&gt;
using System.Text;&lt;br /&gt;
    class MainClass&lt;br /&gt;
    {&lt;br /&gt;
        static void Main()&lt;br /&gt;
        {&lt;br /&gt;
            Func&amp;lt;int, Func&amp;lt;int, int&amp;gt;&amp;gt; accumulatorGenerator = (n =&amp;gt; (i =&amp;gt; n += i+8));&lt;br /&gt;
            var accumulator = accumulatorGenerator(1);&lt;br /&gt;
            Console.WriteLine(accumulator(1));&lt;br /&gt;
        }&lt;br /&gt;
    }&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Add extension to Func==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;using System;&lt;br /&gt;
using System.Collections.Generic;&lt;br /&gt;
using System.Linq;&lt;br /&gt;
using System.Text;&lt;br /&gt;
    static class CurryingExtensions&lt;br /&gt;
    {&lt;br /&gt;
        public static Func&amp;lt;A, Func&amp;lt;B, R&amp;gt;&amp;gt; myExt&amp;lt;A, B, R&amp;gt;(this Func&amp;lt;A, B, R&amp;gt; f)&lt;br /&gt;
        {&lt;br /&gt;
            return a =&amp;gt; b =&amp;gt; f(a, b);&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
    class MainClass&lt;br /&gt;
    {&lt;br /&gt;
        static void Main()&lt;br /&gt;
        {&lt;br /&gt;
            Func&amp;lt;int, int, int&amp;gt; adder = (x, y) =&amp;gt; (x + y);&lt;br /&gt;
            Func&amp;lt;int, Func&amp;lt;int, int&amp;gt;&amp;gt; c = adder.myExt();&lt;br /&gt;
            Func&amp;lt;int, int&amp;gt; addsTwo = c(2);&lt;br /&gt;
            Console.WriteLine(addsTwo(5)); &lt;br /&gt;
        }&lt;br /&gt;
    }&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Build the necessary Func&amp;lt;&amp;gt; delegates using anonymous methods==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;using System;&lt;br /&gt;
using System.Collections.Generic;&lt;br /&gt;
using System.Text;&lt;br /&gt;
using System.Xml.Linq;&lt;br /&gt;
using System.Linq;&lt;br /&gt;
    class Program&lt;br /&gt;
    {&lt;br /&gt;
        static void Main(string[] args)&lt;br /&gt;
        {&lt;br /&gt;
            string[] currentVideoGames = {&amp;quot;test&amp;quot;, &amp;quot;this is a test&amp;quot;, &amp;quot;asdf&amp;quot;, &amp;quot;game 1&amp;quot;,&amp;quot;game 2&amp;quot;, &amp;quot;game 3&amp;quot;};&lt;br /&gt;
            Func&amp;lt;string, bool&amp;gt; searchFilter = delegate(string game) { return game.Length &amp;gt; 6; };&lt;br /&gt;
            Func&amp;lt;string, string&amp;gt; itemToProcess = delegate(string s) { return s; };&lt;br /&gt;
            var subset = currentVideoGames&lt;br /&gt;
                .Where(searchFilter).OrderBy(itemToProcess).Select(itemToProcess);&lt;br /&gt;
            // Print out the results.&lt;br /&gt;
            foreach (var game in subset)&lt;br /&gt;
                Console.WriteLine(&amp;quot;Item: {0}&amp;quot;, game);&lt;br /&gt;
        }&lt;br /&gt;
    }&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Double recursive extension==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;using System;&lt;br /&gt;
using System.Collections.Generic;&lt;br /&gt;
using System.Linq;&lt;br /&gt;
using System.Text;&lt;br /&gt;
    static class DoubleApplicationExtensions&lt;br /&gt;
    {&lt;br /&gt;
        public static Func&amp;lt;T, T&amp;gt; ApplyTwice&amp;lt;T&amp;gt;(this Func&amp;lt;T, T&amp;gt; original)&lt;br /&gt;
        {&lt;br /&gt;
            return x =&amp;gt; original(original(x));&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
    class MainClass&lt;br /&gt;
    {&lt;br /&gt;
        static void Main()&lt;br /&gt;
        {&lt;br /&gt;
            Func&amp;lt;int, int&amp;gt; incrementer = x =&amp;gt; x + x;&lt;br /&gt;
            Func&amp;lt;int, int&amp;gt; doubleIncrementer = incrementer.ApplyTwice();&lt;br /&gt;
            Console.WriteLine(doubleIncrementer(5));&lt;br /&gt;
        }&lt;br /&gt;
    }&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Lambda Expression for Func==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;using System;&lt;br /&gt;
using System.Collections.Generic;&lt;br /&gt;
using System.Text;&lt;br /&gt;
using System.ruponentModel;&lt;br /&gt;
&lt;br /&gt;
    class LambdaExpression&lt;br /&gt;
    {&lt;br /&gt;
        static void Main()&lt;br /&gt;
        {&lt;br /&gt;
            Func&amp;lt;int, int, string&amp;gt; func = (x, y) =&amp;gt; (x * y).ToString();&lt;br /&gt;
            Console.WriteLine(func(5, 20));&lt;br /&gt;
        }&lt;br /&gt;
    }&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Lambda Expression to retrieve string length==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;using System;&lt;br /&gt;
using System.ruponentModel;&lt;br /&gt;
    class MainClass&lt;br /&gt;
    {&lt;br /&gt;
        static void Main()&lt;br /&gt;
        {&lt;br /&gt;
            Func&amp;lt;string, int&amp;gt; returnLength = (string text) =&amp;gt; { return text.Length; };&lt;br /&gt;
            Console.WriteLine(returnLength(&amp;quot;Hello&amp;quot;));&lt;br /&gt;
        }&lt;br /&gt;
    }&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Overloading By Delegate Return Type==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;using System;&lt;br /&gt;
using System.ruponentModel;&lt;br /&gt;
    class MainClass&lt;br /&gt;
    {&lt;br /&gt;
        static void Execute(Func&amp;lt;int&amp;gt; action)&lt;br /&gt;
        {&lt;br /&gt;
            Console.WriteLine(&amp;quot;action returns an int: &amp;quot; + action());&lt;br /&gt;
        }&lt;br /&gt;
        static void Execute(Func&amp;lt;double&amp;gt; action)&lt;br /&gt;
        {&lt;br /&gt;
            Console.WriteLine(&amp;quot;action returns a double: &amp;quot; + action());&lt;br /&gt;
        }&lt;br /&gt;
        static void Main()&lt;br /&gt;
        {&lt;br /&gt;
            Execute(() =&amp;gt; 1);&lt;br /&gt;
        }&lt;br /&gt;
    }&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Pass the delegates into the methods of Sequence==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;using System;&lt;br /&gt;
using System.Collections.Generic;&lt;br /&gt;
using System.Text;&lt;br /&gt;
using System.Xml.Linq;&lt;br /&gt;
using System.Linq;&lt;br /&gt;
    class Program&lt;br /&gt;
    {&lt;br /&gt;
        static void Main(string[] args)&lt;br /&gt;
        {&lt;br /&gt;
            string[] currentVideoGames = {&amp;quot;test&amp;quot;, &amp;quot;this is a test&amp;quot;, &lt;br /&gt;
                          &amp;quot;asdf&amp;quot;, &amp;quot;game 1&amp;quot;,&lt;br /&gt;
                          &amp;quot;game 2&amp;quot;, &amp;quot;game 3&amp;quot;};&lt;br /&gt;
            Func&amp;lt;string, bool&amp;gt; searchFilter = delegate(string game) { return game.Length &amp;gt; 6; };&lt;br /&gt;
            Func&amp;lt;string, string&amp;gt; itemToProcess = delegate(string s) { return s; };&lt;br /&gt;
            var subset = currentVideoGames&lt;br /&gt;
                .Where(searchFilter).OrderBy(itemToProcess).Select(itemToProcess);&lt;br /&gt;
            foreach (var game in subset)&lt;br /&gt;
                Console.WriteLine(&amp;quot;Item: {0}&amp;quot;, game);&lt;br /&gt;
        }&lt;br /&gt;
    }&amp;lt;/source&amp;gt;&lt;/div&gt;</summary>
		<author><name>Admin</name></author>	</entry>

	</feed>