<?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%2FC_Sharp%2FLanguage_Basics%2FFunction_Definition</id>
		<title>Csharp/C Sharp/Language Basics/Function Definition - История изменений</title>
		<link rel="self" type="application/atom+xml" href="http://nfex.ru/index.php?action=history&amp;feed=atom&amp;title=Csharp%2FC_Sharp%2FLanguage_Basics%2FFunction_Definition"/>
		<link rel="alternate" type="text/html" href="http://nfex.ru/index.php?title=Csharp/C_Sharp/Language_Basics/Function_Definition&amp;action=history"/>
		<updated>2026-04-29T17:54:09Z</updated>
		<subtitle>История изменений этой страницы в вики</subtitle>
		<generator>MediaWiki 1.30.0</generator>

	<entry>
		<id>http://nfex.ru/index.php?title=Csharp/C_Sharp/Language_Basics/Function_Definition&amp;diff=736&amp;oldid=prev</id>
		<title> в 15:31, 26 мая 2010</title>
		<link rel="alternate" type="text/html" href="http://nfex.ru/index.php?title=Csharp/C_Sharp/Language_Basics/Function_Definition&amp;diff=736&amp;oldid=prev"/>
				<updated>2010-05-26T15:31:18Z</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/C_Sharp/Language_Basics/Function_Definition&amp;diff=737&amp;oldid=prev</id>
		<title>Admin: 1 версия</title>
		<link rel="alternate" type="text/html" href="http://nfex.ru/index.php?title=Csharp/C_Sharp/Language_Basics/Function_Definition&amp;diff=737&amp;oldid=prev"/>
				<updated>2010-05-26T11:39:42Z</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;==Catch StackOverflowException for recursive function==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
using System;&lt;br /&gt;
   &lt;br /&gt;
class MainClass&lt;br /&gt;
{&lt;br /&gt;
    public static void Main()&lt;br /&gt;
    {&lt;br /&gt;
        try&lt;br /&gt;
        {&lt;br /&gt;
            Recursive();&lt;br /&gt;
        }&lt;br /&gt;
        catch(StackOverflowException)&lt;br /&gt;
        {&lt;br /&gt;
            Console.WriteLine(&amp;quot;The CLR is out of stack space.&amp;quot;);&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
   &lt;br /&gt;
    public static void Recursive()&lt;br /&gt;
    {&lt;br /&gt;
        Recursive();&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
           &lt;br /&gt;
       &amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Define function==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;&lt;br /&gt;
/*&lt;br /&gt;
Learning C# &lt;br /&gt;
by Jesse Liberty&lt;br /&gt;
Publisher: O&amp;quot;Reilly &lt;br /&gt;
ISBN: 0596003765&lt;br /&gt;
*/&lt;br /&gt;
 using System;&lt;br /&gt;
public class Functions&lt;br /&gt;
 {&lt;br /&gt;
     static void Main()&lt;br /&gt;
     {&lt;br /&gt;
         Console.WriteLine(&amp;quot;In Main! Calling SomeMethod()...&amp;quot;);&lt;br /&gt;
         SomeMethod();&lt;br /&gt;
         Console.WriteLine(&amp;quot;Back in Main().&amp;quot;);&lt;br /&gt;
     }&lt;br /&gt;
     static void SomeMethod()&lt;br /&gt;
     {&lt;br /&gt;
         Console.WriteLine(&amp;quot;Greetings from SomeMethod!&amp;quot;);&lt;br /&gt;
     }&lt;br /&gt;
 }&lt;br /&gt;
           &lt;br /&gt;
       &amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Recursive Factorial method.==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt; &lt;br /&gt;
&lt;br /&gt;
using System;&lt;br /&gt;
public class FactorialTest&lt;br /&gt;
{&lt;br /&gt;
   public static void Main( string[] args )&lt;br /&gt;
   {&lt;br /&gt;
      for ( long counter = 0; counter &amp;lt;= 10; counter++ )&lt;br /&gt;
         Console.WriteLine( &amp;quot;{0}! = {1}&amp;quot;, counter, Factorial( counter ) );&lt;br /&gt;
   } &lt;br /&gt;
   public static long Factorial( long number )&lt;br /&gt;
   {&lt;br /&gt;
      if ( number &amp;lt;= 1 )&lt;br /&gt;
         return 1;&lt;br /&gt;
      else&lt;br /&gt;
         return number * Factorial( number - 1 );&lt;br /&gt;
   } &lt;br /&gt;
} &lt;br /&gt;
&lt;br /&gt;
              &amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Recursive function in action==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;&lt;br /&gt;
using System;&lt;br /&gt;
public class FactorialTest&lt;br /&gt;
{&lt;br /&gt;
   public static void Main( string[] args )&lt;br /&gt;
   {&lt;br /&gt;
      for ( long counter = 0; counter &amp;lt;= 10; counter++ )&lt;br /&gt;
         Console.WriteLine( &amp;quot;{0}! = {1}&amp;quot;,&lt;br /&gt;
            counter, Factorial( counter ) );&lt;br /&gt;
   }&lt;br /&gt;
   public static long Factorial( long number )&lt;br /&gt;
   {&lt;br /&gt;
      if ( number &amp;lt;= 1 )&lt;br /&gt;
         return 1;&lt;br /&gt;
      else&lt;br /&gt;
         return number * Factorial( number - 1 );&lt;br /&gt;
   }&lt;br /&gt;
}&lt;br /&gt;
           &lt;br /&gt;
       &amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Recursive sum method==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;&lt;br /&gt;
public class SumPrices {&lt;br /&gt;
  public static double Sum(double[] p, int start, int end) {&lt;br /&gt;
    if (start &amp;lt; end)&lt;br /&gt;
       return p[start] + Sum(p,start+1,end);&lt;br /&gt;
    else return 0;&lt;br /&gt;
  }&lt;br /&gt;
  public static void Main() {&lt;br /&gt;
    double[] prices = {1.3, 13.68, 314.919, 82.827, 363.949};&lt;br /&gt;
    System.Console.WriteLine(&amp;quot;The sum is {0:C}&amp;quot;, Sum(prices,0,prices.Length));&lt;br /&gt;
  }&lt;br /&gt;
} &lt;br /&gt;
           &lt;br /&gt;
       &amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Use a recursive method, travel, to journey from start to finish==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;&lt;br /&gt;
using System;&lt;br /&gt;
public class Journey {&lt;br /&gt;
  private static String indent = &amp;quot;&amp;quot;;&lt;br /&gt;
  &lt;br /&gt;
  public static void TakeOneStep(int step) {&lt;br /&gt;
    Console.WriteLine(&amp;quot;{0}Taking step {1}&amp;quot;, indent, step);&lt;br /&gt;
  }&lt;br /&gt;
  &lt;br /&gt;
  public static void Move(int start, int finish) {&lt;br /&gt;
    string oldIndent = indent;&lt;br /&gt;
    Console.WriteLine(&amp;quot;{0}Starting move from {1} to {2}&amp;quot;, indent, start, finish);&lt;br /&gt;
    if (start &amp;lt; finish) {&lt;br /&gt;
      TakeOneStep(start);&lt;br /&gt;
      indent += &amp;quot;   &amp;quot;; &lt;br /&gt;
      Move(start+1, finish);&lt;br /&gt;
      indent = oldIndent;&lt;br /&gt;
    }&lt;br /&gt;
    Console.WriteLine(&amp;quot;{0}Finishing move from {1} to {2}&amp;quot;,indent, start, finish);&lt;br /&gt;
  }&lt;br /&gt;
  public static void Main(String [] args) {&lt;br /&gt;
    Move(1, 10);&lt;br /&gt;
  }&lt;br /&gt;
} &lt;br /&gt;
&lt;br /&gt;
           &lt;br /&gt;
       &amp;lt;/source&amp;gt;&lt;/div&gt;</summary>
		<author><name>Admin</name></author>	</entry>

	</feed>