<?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%2FOperator%2FPrefix_Postfix_Operator</id>
		<title>Csharp/CSharp Tutorial/Operator/Prefix Postfix Operator - История изменений</title>
		<link rel="self" type="application/atom+xml" href="http://nfex.ru/index.php?action=history&amp;feed=atom&amp;title=Csharp%2FCSharp_Tutorial%2FOperator%2FPrefix_Postfix_Operator"/>
		<link rel="alternate" type="text/html" href="http://nfex.ru/index.php?title=Csharp/CSharp_Tutorial/Operator/Prefix_Postfix_Operator&amp;action=history"/>
		<updated>2026-04-29T17:15:03Z</updated>
		<subtitle>История изменений этой страницы в вики</subtitle>
		<generator>MediaWiki 1.30.0</generator>

	<entry>
		<id>http://nfex.ru/index.php?title=Csharp/CSharp_Tutorial/Operator/Prefix_Postfix_Operator&amp;diff=5794&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/Operator/Prefix_Postfix_Operator&amp;diff=5794&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/Operator/Prefix_Postfix_Operator&amp;diff=5795&amp;oldid=prev</id>
		<title>Admin: 1 версия</title>
		<link rel="alternate" type="text/html" href="http://nfex.ru/index.php?title=Csharp/CSharp_Tutorial/Operator/Prefix_Postfix_Operator&amp;diff=5795&amp;oldid=prev"/>
				<updated>2010-05-26T12:17:27Z</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;==Increment and Decrement==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;The ++ and the -- are the increment and decrement operators.&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;The increment operator adds 1 to its operand, and the decrement operator subtracts 1.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;x = x + 1;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Operators ++==&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;
  class Class1&lt;br /&gt;
  {&lt;br /&gt;
    [STAThread]&lt;br /&gt;
    static void Main(string[] args)&lt;br /&gt;
    {&lt;br /&gt;
      MyCar car = 5;&lt;br /&gt;
            for( int i = 0; i &amp;lt; 20; ++i )&lt;br /&gt;
            {&lt;br /&gt;
                car++;&lt;br /&gt;
                Console.WriteLine( &amp;quot;{0}&amp;quot;, car.GetSpeed());&lt;br /&gt;
            }&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
  public class MyCar&lt;br /&gt;
  {&lt;br /&gt;
        private static int speed = 2;&lt;br /&gt;
        private const int maxSpeed = 200;&lt;br /&gt;
        &lt;br /&gt;
        public bool ChangeSpeed(int newSpeed)&lt;br /&gt;
        {&lt;br /&gt;
            if( newSpeed &amp;gt; maxSpeed )&lt;br /&gt;
                return false;&lt;br /&gt;
            speed = newSpeed;&lt;br /&gt;
            return true;&lt;br /&gt;
        }&lt;br /&gt;
        public static MyCar operator ++( MyCar car )&lt;br /&gt;
        {&lt;br /&gt;
            car.ChangeSpeed(++speed);&lt;br /&gt;
            return car;&lt;br /&gt;
        }&lt;br /&gt;
        public static implicit operator MyCar( int from )&lt;br /&gt;
        {&lt;br /&gt;
            MyCar car = new MyCar();&lt;br /&gt;
            car.ChangeSpeed( from );&lt;br /&gt;
            return car;&lt;br /&gt;
        }&lt;br /&gt;
        public int GetSpeed()&lt;br /&gt;
        {&lt;br /&gt;
            return speed;&lt;br /&gt;
        }&lt;br /&gt;
  }&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==postfix decrement==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;class MainClass&lt;br /&gt;
{&lt;br /&gt;
  public static void Main()&lt;br /&gt;
  {&lt;br /&gt;
    int length = 3;&lt;br /&gt;
    int newLength = length--;&lt;br /&gt;
    System.Console.WriteLine(&amp;quot;Postfix decrement example&amp;quot;);&lt;br /&gt;
    System.Console.WriteLine(&amp;quot;length = &amp;quot; + length);&lt;br /&gt;
    System.Console.WriteLine(&amp;quot;newLength = &amp;quot; + newLength);&lt;br /&gt;
  }&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;pre class=codeResult&amp;gt;Postfix decrement example&lt;br /&gt;
length = 2&lt;br /&gt;
newLength = 3&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==postfix increment==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;class MainClass&lt;br /&gt;
{&lt;br /&gt;
  public static void Main()&lt;br /&gt;
  {&lt;br /&gt;
    int length = 3;&lt;br /&gt;
    int newLength = length++;&lt;br /&gt;
    System.Console.WriteLine(&amp;quot;Postfix increment example&amp;quot;);&lt;br /&gt;
    System.Console.WriteLine(&amp;quot;length = &amp;quot; + length);&lt;br /&gt;
    System.Console.WriteLine(&amp;quot;newLength = &amp;quot; + newLength);&lt;br /&gt;
  }&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;pre class=codeResult&amp;gt;Postfix increment example&lt;br /&gt;
length = 4&lt;br /&gt;
newLength = 3&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Pre And Post Increment==&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;
class MainClass&lt;br /&gt;
{&lt;br /&gt;
   static void Main()&lt;br /&gt;
   {&lt;br /&gt;
      int x = 5, y;&lt;br /&gt;
      y = x++;                        &lt;br /&gt;
      Console.WriteLine(&amp;quot;y: {0}, x: {1}&amp;quot;, y, x);&lt;br /&gt;
      x = 5;&lt;br /&gt;
      y = ++x;                        &lt;br /&gt;
      Console.WriteLine(&amp;quot;y: {0}, x: {1}&amp;quot;, y, x);&lt;br /&gt;
      x = 5;&lt;br /&gt;
      y = x--;                        &lt;br /&gt;
      Console.WriteLine(&amp;quot;y: {0}, x: {1}&amp;quot;, y, x);&lt;br /&gt;
      x = 5;&lt;br /&gt;
      y = --x;                        &lt;br /&gt;
      Console.WriteLine(&amp;quot;y: {0}, x: {1}&amp;quot;, y, x);&lt;br /&gt;
   }&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;pre class=codeResult&amp;gt;y: 5, x: 6&lt;br /&gt;
y: 6, x: 6&lt;br /&gt;
y: 5, x: 4&lt;br /&gt;
y: 4, x: 4&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==prefix decrement==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;class MainClass&lt;br /&gt;
{&lt;br /&gt;
  public static void Main()&lt;br /&gt;
  {&lt;br /&gt;
    &lt;br /&gt;
    int length = 3;&lt;br /&gt;
    int newLength = --length;&lt;br /&gt;
    System.Console.WriteLine(&amp;quot;Prefix decrement example&amp;quot;);&lt;br /&gt;
    System.Console.WriteLine(&amp;quot;length = &amp;quot; + length);&lt;br /&gt;
    System.Console.WriteLine(&amp;quot;newLength = &amp;quot; + newLength);&lt;br /&gt;
  }&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;pre class=codeResult&amp;gt;Prefix decrement example&lt;br /&gt;
length = 2&lt;br /&gt;
newLength = 2&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==prefix increment==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;class MainClass&lt;br /&gt;
{&lt;br /&gt;
  public static void Main()&lt;br /&gt;
  {&lt;br /&gt;
    int length = 3;&lt;br /&gt;
    int newLength = ++length;&lt;br /&gt;
    System.Console.WriteLine(&amp;quot;Prefix increment example&amp;quot;);&lt;br /&gt;
    System.Console.WriteLine(&amp;quot;length = &amp;quot; + length);&lt;br /&gt;
    System.Console.WriteLine(&amp;quot;newLength = &amp;quot; + newLength);&lt;br /&gt;
  }&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;pre class=codeResult&amp;gt;Prefix increment example&lt;br /&gt;
length = 4&lt;br /&gt;
newLength = 4&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==The difference between prefix and postfix forms of ++==&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;
 &lt;br /&gt;
class Example {  &lt;br /&gt;
  public static void Main() {    &lt;br /&gt;
    int x, y; &lt;br /&gt;
    int i; &lt;br /&gt;
 &lt;br /&gt;
    x = 1; &lt;br /&gt;
    Console.WriteLine(&amp;quot;Series generated using y = x + x++;&amp;quot;); &lt;br /&gt;
    for(i = 0; i &amp;lt; 10; i++) { &lt;br /&gt;
      y = x + x++; // postfix ++ &lt;br /&gt;
      Console.WriteLine(y + &amp;quot; &amp;quot;); &lt;br /&gt;
    } &lt;br /&gt;
    Console.WriteLine(); &lt;br /&gt;
 &lt;br /&gt;
    x = 1; &lt;br /&gt;
    Console.WriteLine(&amp;quot;Series generated using y = x + ++x;&amp;quot;); &lt;br /&gt;
    for(i = 0; i &amp;lt; 10; i++) { &lt;br /&gt;
      y = x + ++x; // prefix ++ &lt;br /&gt;
      Console.WriteLine(y + &amp;quot; &amp;quot;); &lt;br /&gt;
    } &lt;br /&gt;
    Console.WriteLine(); &lt;br /&gt;
    &lt;br /&gt;
  } &lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;pre class=codeResult&amp;gt;Series generated using y = x + x++;&lt;br /&gt;
2&lt;br /&gt;
4&lt;br /&gt;
6&lt;br /&gt;
8&lt;br /&gt;
10&lt;br /&gt;
12&lt;br /&gt;
14&lt;br /&gt;
16&lt;br /&gt;
18&lt;br /&gt;
20&lt;br /&gt;
Series generated using y = x + ++x;&lt;br /&gt;
3&lt;br /&gt;
5&lt;br /&gt;
7&lt;br /&gt;
9&lt;br /&gt;
11&lt;br /&gt;
13&lt;br /&gt;
15&lt;br /&gt;
17&lt;br /&gt;
19&lt;br /&gt;
21&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Using the Post-Increment Operator==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;class MainClass&lt;br /&gt;
{&lt;br /&gt;
  static void Main()&lt;br /&gt;
  {&lt;br /&gt;
    int count;&lt;br /&gt;
    int result;&lt;br /&gt;
    count = 0;&lt;br /&gt;
    result = count++; &lt;br /&gt;
    System.Console.WriteLine(&amp;quot;result = {0} and count = {1}&amp;quot;,result, count);&lt;br /&gt;
  }&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Using the Pre-Increment Operator==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;class MainClass&lt;br /&gt;
{&lt;br /&gt;
  static void Main()&lt;br /&gt;
  {&lt;br /&gt;
    int count;&lt;br /&gt;
    int result;&lt;br /&gt;
    count = 0;&lt;br /&gt;
    result = ++count;&lt;br /&gt;
    System.Console.WriteLine(&amp;quot;result = {0} and count = {1}&amp;quot;, result, count);&lt;br /&gt;
  }&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;/div&gt;</summary>
		<author><name>Admin</name></author>	</entry>

	</feed>