<?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%2FRef_Out</id>
		<title>Csharp/C Sharp/Language Basics/Ref Out - История изменений</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%2FRef_Out"/>
		<link rel="alternate" type="text/html" href="http://nfex.ru/index.php?title=Csharp/C_Sharp/Language_Basics/Ref_Out&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/Ref_Out&amp;diff=696&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/Ref_Out&amp;diff=696&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/Ref_Out&amp;diff=697&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/Ref_Out&amp;diff=697&amp;oldid=prev"/>
				<updated>2010-05-26T11:39:33Z</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;==compare the difference between passing a null reference vs. a reference to a zero length string==&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 Class1 {&lt;br /&gt;
    public static void Main(string[] strings) {&lt;br /&gt;
        Example exampleObject = new Example();&lt;br /&gt;
        Console.WriteLine(&amp;quot;Pass a null object:&amp;quot;);&lt;br /&gt;
        string s = null;&lt;br /&gt;
        exampleObject.TestString(s);&lt;br /&gt;
        Console.WriteLine();&lt;br /&gt;
        Console.WriteLine(&amp;quot;Pass an empty string:&amp;quot;);&lt;br /&gt;
        exampleObject.TestString(&amp;quot;&amp;quot;);&lt;br /&gt;
        Console.WriteLine();&lt;br /&gt;
        Console.WriteLine(&amp;quot;Pass a real string:&amp;quot;);&lt;br /&gt;
        exampleObject.TestString(&amp;quot;test string&amp;quot;);&lt;br /&gt;
        Console.WriteLine();&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
class Example {&lt;br /&gt;
    public void TestString(string sTest) {&lt;br /&gt;
        if (sTest == null) {&lt;br /&gt;
            Console.WriteLine(&amp;quot;sTest is null&amp;quot;);&lt;br /&gt;
            return;&lt;br /&gt;
        }&lt;br /&gt;
        if (String.rupare(sTest, &amp;quot;&amp;quot;) == 0) {&lt;br /&gt;
            Console.WriteLine(&amp;quot;sTest references an empty string&amp;quot;);&lt;br /&gt;
            return;&lt;br /&gt;
        }&lt;br /&gt;
        Console.WriteLine(&amp;quot;sTest refers to: &amp;quot;&amp;quot; + sTest + &amp;quot;&amp;quot;&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
 &amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Reference, output and value parameters.==&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;
&lt;br /&gt;
using System;&lt;br /&gt;
class ReferenceAndOutputParameters&lt;br /&gt;
{&lt;br /&gt;
   public void aMethod()&lt;br /&gt;
   {&lt;br /&gt;
      int y = 5; &lt;br /&gt;
      int z; &lt;br /&gt;
      Console.WriteLine( &amp;quot;Original value of y: {0}&amp;quot;, y );&lt;br /&gt;
      Console.WriteLine( &amp;quot;Original value of z: uninitialized\n&amp;quot; );&lt;br /&gt;
      SquareRef( ref y );  &lt;br /&gt;
      SquareOut( out z );  &lt;br /&gt;
      Console.WriteLine( &amp;quot;Value of y after SquareRef: {0}&amp;quot;, y );&lt;br /&gt;
      Console.WriteLine( &amp;quot;Value of z after SquareOut: {0}\n&amp;quot;, z );&lt;br /&gt;
      Square( y );&lt;br /&gt;
      Square( z );&lt;br /&gt;
      Console.WriteLine( &amp;quot;Value of y after Square: {0}&amp;quot;, y );&lt;br /&gt;
      Console.WriteLine( &amp;quot;Value of z after Square: {0}&amp;quot;, z );&lt;br /&gt;
   } &lt;br /&gt;
   void SquareRef( ref int x )&lt;br /&gt;
   {&lt;br /&gt;
      x = x * x; &lt;br /&gt;
   } &lt;br /&gt;
   void SquareOut( out int x )&lt;br /&gt;
   {&lt;br /&gt;
      x = 6; &lt;br /&gt;
      x = x * x; &lt;br /&gt;
   } &lt;br /&gt;
   void Square( int x )&lt;br /&gt;
   {&lt;br /&gt;
      x = x * x;&lt;br /&gt;
   }&lt;br /&gt;
} &lt;br /&gt;
class ReferenceAndOutputParamtersTest&lt;br /&gt;
{&lt;br /&gt;
   static void Main( string[] args )&lt;br /&gt;
   {&lt;br /&gt;
      ReferenceAndOutputParameters test = new ReferenceAndOutputParameters();&lt;br /&gt;
      test.aMethod();&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;
==Testing the effects of passing array references by value and by reference.==&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 ArrayReferenceTest&lt;br /&gt;
{&lt;br /&gt;
   public static void Main( string[] args )&lt;br /&gt;
   {&lt;br /&gt;
      int[] firstArray = { 1, 2, 3 };&lt;br /&gt;
      int[] firstArrayCopy = firstArray;&lt;br /&gt;
      for ( int i = 0; i &amp;lt; firstArray.Length; i++ )&lt;br /&gt;
         Console.Write( &amp;quot;{0} &amp;quot;, firstArray[ i ] );&lt;br /&gt;
      FirstDouble( firstArray );&lt;br /&gt;
      for ( int i = 0; i &amp;lt; firstArray.Length; i++ )&lt;br /&gt;
         Console.Write( &amp;quot;{0} &amp;quot;, firstArray[ i ] );&lt;br /&gt;
      if ( firstArray == firstArrayCopy )&lt;br /&gt;
         Console.WriteLine(&amp;quot;same&amp;quot; );&lt;br /&gt;
      else&lt;br /&gt;
         Console.WriteLine(&amp;quot;different&amp;quot; );&lt;br /&gt;
      int[] secondArray = { 1, 2, 3 };&lt;br /&gt;
      int[] secondArrayCopy = secondArray;&lt;br /&gt;
      for ( int i = 0; i &amp;lt; secondArray.Length; i++ )&lt;br /&gt;
         Console.Write( &amp;quot;{0} &amp;quot;, secondArray[ i ] );&lt;br /&gt;
      SecondDouble( ref secondArray );&lt;br /&gt;
      for ( int i = 0; i &amp;lt; secondArray.Length; i++ )&lt;br /&gt;
         Console.Write( &amp;quot;{0} &amp;quot;, secondArray[ i ] );&lt;br /&gt;
      if ( secondArray == secondArrayCopy )&lt;br /&gt;
         Console.WriteLine(&amp;quot;same&amp;quot; );&lt;br /&gt;
      else&lt;br /&gt;
         Console.WriteLine(&amp;quot;different&amp;quot; );&lt;br /&gt;
   } &lt;br /&gt;
   public static void FirstDouble( int[] array )&lt;br /&gt;
   {&lt;br /&gt;
      for ( int i = 0; i &amp;lt; array.Length; i++ )&lt;br /&gt;
         array[ i ] *= 2;&lt;br /&gt;
      array = new int[] { 11, 12, 13 };&lt;br /&gt;
   } &lt;br /&gt;
   public static void SecondDouble( ref int[] array )&lt;br /&gt;
   {&lt;br /&gt;
      for ( int i = 0; i &amp;lt; array.Length; i++ )&lt;br /&gt;
         array[ i ] *= 2;&lt;br /&gt;
      array = new int[] { 11, 12, 13 };&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;
==the out descriptor allows a function a value in an argument without initializing the argument==&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 Test {&lt;br /&gt;
    public static void Main(string[] strings) {&lt;br /&gt;
        Student student;&lt;br /&gt;
        Example example = new Example();&lt;br /&gt;
        example.ReturnStudent(out student);&lt;br /&gt;
        Console.WriteLine(&amp;quot;Student is &amp;quot; + student.name);&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
class Example {&lt;br /&gt;
    public void ReturnStudent(out Student student) {&lt;br /&gt;
        student = new Student();&lt;br /&gt;
        student.name = &amp;quot;Jenny&amp;quot;;&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
public class Student {&lt;br /&gt;
    public string name;&lt;br /&gt;
}&lt;br /&gt;
 &amp;lt;/source&amp;gt;&lt;/div&gt;</summary>
		<author><name>Admin</name></author>	</entry>

	</feed>