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

	<entry>
		<id>http://nfex.ru/index.php?title=Csharp/CSharp_Tutorial/Language_Basics/out&amp;diff=6548&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/Language_Basics/out&amp;diff=6548&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/Language_Basics/out&amp;diff=6549&amp;oldid=prev</id>
		<title>Admin: 1 версия</title>
		<link rel="alternate" type="text/html" href="http://nfex.ru/index.php?title=Csharp/CSharp_Tutorial/Language_Basics/out&amp;diff=6549&amp;oldid=prev"/>
				<updated>2010-05-26T12:19:22Z</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;==Out Parameters==&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 Point&lt;br /&gt;
{&lt;br /&gt;
    public Point(int x, int y)&lt;br /&gt;
    {&lt;br /&gt;
        this.x = x;&lt;br /&gt;
        this.y = y;&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    public void GetPoint(out int x, out int y)&lt;br /&gt;
    {&lt;br /&gt;
        x = this.x;&lt;br /&gt;
        y = this.y;&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    int x;&lt;br /&gt;
    int y;&lt;br /&gt;
}&lt;br /&gt;
class MainClass&lt;br /&gt;
{&lt;br /&gt;
    public static void Main()&lt;br /&gt;
    {&lt;br /&gt;
        Point myPoint = new Point(10, 15);&lt;br /&gt;
        int x;&lt;br /&gt;
        int y;&lt;br /&gt;
        &lt;br /&gt;
        myPoint.GetPoint(out x, out y);&lt;br /&gt;
        Console.WriteLine(&amp;quot;myPoint({0}, {1})&amp;quot;, x, y);&lt;br /&gt;
    }&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;pre class=codeResult&amp;gt;myPoint(10, 15)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Ref and Out Parameters==&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 Point&lt;br /&gt;
{&lt;br /&gt;
    public Point(int x, int y)&lt;br /&gt;
    {&lt;br /&gt;
        this.x = x;&lt;br /&gt;
        this.y = y;&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    public void GetPoint(ref int x, ref int y)&lt;br /&gt;
    {&lt;br /&gt;
        x = this.x;&lt;br /&gt;
        y = this.y;&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    int x;&lt;br /&gt;
    int y;&lt;br /&gt;
}&lt;br /&gt;
class MainClass&lt;br /&gt;
{&lt;br /&gt;
    public static void Main()&lt;br /&gt;
    {&lt;br /&gt;
        Point myPoint = new Point(10, 15);&lt;br /&gt;
        int x = 0;&lt;br /&gt;
        int y = 0;&lt;br /&gt;
        &lt;br /&gt;
        myPoint.GetPoint(ref x, ref y);&lt;br /&gt;
        Console.WriteLine(&amp;quot;myPoint({0}, {1})&amp;quot;, x, y);&lt;br /&gt;
    }&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;pre class=codeResult&amp;gt;myPoint(10, 15)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Use out==&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 Decompose { &lt;br /&gt;
 &lt;br /&gt;
  public int parts(double n, out double frac) { &lt;br /&gt;
    int whole; &lt;br /&gt;
 &lt;br /&gt;
    whole = (int) n; &lt;br /&gt;
    frac = n - whole; // pass fractional part back through frac &lt;br /&gt;
    return whole; // return integer portion &lt;br /&gt;
  } &lt;br /&gt;
} &lt;br /&gt;
  &lt;br /&gt;
class MainClass { &lt;br /&gt;
  public static void Main() {   &lt;br /&gt;
   Decompose ob = new Decompose(); &lt;br /&gt;
    int i; &lt;br /&gt;
    double f; &lt;br /&gt;
 &lt;br /&gt;
    i = ob.parts(10.125, out f); &lt;br /&gt;
 &lt;br /&gt;
    Console.WriteLine(&amp;quot;Integer portion is &amp;quot; + i); &lt;br /&gt;
    Console.WriteLine(&amp;quot;Fractional part is &amp;quot; + f); &lt;br /&gt;
  } &lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;pre class=codeResult&amp;gt;Integer portion is 10&lt;br /&gt;
Fractional part is 0.125&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Use &amp;quot;out&amp;quot; keyword (no need to assign because it is an out)==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;OL&amp;gt;&amp;lt;LI&amp;gt;An out parameter is used to pass a value out of a method.&amp;lt;/LI&amp;gt;&amp;lt;LI&amp;gt;It is not necessary to give the variable used as an out parameter an initial value.&amp;lt;/LI&amp;gt;&amp;lt;LI&amp;gt;An out parameter is always considered unassigned.&amp;lt;/LI&amp;gt;&amp;lt;LI&amp;gt;The method must assign the parameter a value prior to the method&amp;quot;s termination.&amp;lt;/LI&amp;gt;&amp;lt;/OL&amp;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;
  public static void Add(int x,int y, out int ans)&lt;br /&gt;
  {&lt;br /&gt;
    ans = x + y;&lt;br /&gt;
  }&lt;br /&gt;
  public static void Main() &lt;br /&gt;
  {&lt;br /&gt;
    &lt;br /&gt;
    Console.WriteLine(&amp;quot;Adding 2 ints using out keyword&amp;quot;);&lt;br /&gt;
    int ans;&lt;br /&gt;
    Add(90, 90, out ans);&lt;br /&gt;
    Console.WriteLine(&amp;quot;90 + 90 = {0}\n&amp;quot;, ans);&lt;br /&gt;
  }&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;pre class=codeResult&amp;gt;Adding 2 ints using out keyword&lt;br /&gt;
90 + 90 = 180&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Use two out parameters==&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 Num { &lt;br /&gt;
   &lt;br /&gt;
  public bool hasComFactor(int x, int y,out int least, out int greatest) { &lt;br /&gt;
    least = 1; &lt;br /&gt;
    greatest = 1;  &lt;br /&gt;
 &lt;br /&gt;
    if(least != 1) &lt;br /&gt;
       return true; &lt;br /&gt;
    else &lt;br /&gt;
       return false; &lt;br /&gt;
  } &lt;br /&gt;
} &lt;br /&gt;
  &lt;br /&gt;
class MainClass { &lt;br /&gt;
  public static void Main() {   &lt;br /&gt;
    Num ob = new Num(); &lt;br /&gt;
    int lcf, gcf; &lt;br /&gt;
 &lt;br /&gt;
    if(ob.hasComFactor(231, 105, out lcf, out gcf)) { &lt;br /&gt;
      Console.WriteLine(&amp;quot;Lcf of 231 and 105 is &amp;quot; + lcf); &lt;br /&gt;
      Console.WriteLine(&amp;quot;Gcf of 231 and 105 is &amp;quot; + gcf); &lt;br /&gt;
    } &lt;br /&gt;
    else &lt;br /&gt;
      Console.WriteLine(&amp;quot;No common factor for 35 and 49.&amp;quot;); &lt;br /&gt;
 &lt;br /&gt;
    if(ob.hasComFactor(35, 51, out lcf, out gcf)) { &lt;br /&gt;
      Console.WriteLine(&amp;quot;Lcf of 35 and 51 &amp;quot; + lcf); &lt;br /&gt;
      Console.WriteLine(&amp;quot;Gcf of 35 and 51 is &amp;quot; + gcf); &lt;br /&gt;
    } &lt;br /&gt;
    else &lt;br /&gt;
      Console.WriteLine(&amp;quot;No common factor for 35 and 51.&amp;quot;); &lt;br /&gt;
 &lt;br /&gt;
  } &lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;pre class=codeResult&amp;gt;No common factor for 35 and 49.&lt;br /&gt;
No common factor for 35 and 51.&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Admin</name></author>	</entry>

	</feed>