<?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%2FData_Structure%2FArray_Index</id>
		<title>Csharp/CSharp Tutorial/Data Structure/Array Index - История изменений</title>
		<link rel="self" type="application/atom+xml" href="http://nfex.ru/index.php?action=history&amp;feed=atom&amp;title=Csharp%2FCSharp_Tutorial%2FData_Structure%2FArray_Index"/>
		<link rel="alternate" type="text/html" href="http://nfex.ru/index.php?title=Csharp/CSharp_Tutorial/Data_Structure/Array_Index&amp;action=history"/>
		<updated>2026-04-30T05:44:04Z</updated>
		<subtitle>История изменений этой страницы в вики</subtitle>
		<generator>MediaWiki 1.30.0</generator>

	<entry>
		<id>http://nfex.ru/index.php?title=Csharp/CSharp_Tutorial/Data_Structure/Array_Index&amp;diff=5575&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/Data_Structure/Array_Index&amp;diff=5575&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/Data_Structure/Array_Index&amp;diff=5576&amp;oldid=prev</id>
		<title>Admin: 1 версия</title>
		<link rel="alternate" type="text/html" href="http://nfex.ru/index.php?title=Csharp/CSharp_Tutorial/Data_Structure/Array_Index&amp;diff=5576&amp;oldid=prev"/>
				<updated>2010-05-26T12:15:56Z</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;==Assigning array reference variables==&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 MainClass {  &lt;br /&gt;
  public static void Main() {  &lt;br /&gt;
    int i; &lt;br /&gt;
 &lt;br /&gt;
    int[] nums1 = new int[10]; &lt;br /&gt;
    int[] nums2 = new int[10]; &lt;br /&gt;
 &lt;br /&gt;
    for(i=0; i &amp;lt; 10; i++) &lt;br /&gt;
       nums1[i] = i; &lt;br /&gt;
 &lt;br /&gt;
    for(i=0; i &amp;lt; 10; i++) &lt;br /&gt;
       nums2[i] = -i; &lt;br /&gt;
 &lt;br /&gt;
    Console.Write(&amp;quot;Here is nums1: &amp;quot;); &lt;br /&gt;
    for(i=0; i &amp;lt; 10; i++) &lt;br /&gt;
      Console.Write(nums1[i] + &amp;quot; &amp;quot;);   &lt;br /&gt;
    Console.Write(&amp;quot;Here is nums2: &amp;quot;); &lt;br /&gt;
    for(i=0; i &amp;lt; 10; i++) &lt;br /&gt;
      Console.Write(nums2[i] + &amp;quot; &amp;quot;);   &lt;br /&gt;
    Console.WriteLine(); &lt;br /&gt;
 &lt;br /&gt;
    nums2 = nums1; // now nums2 refers to nums1 &lt;br /&gt;
 &lt;br /&gt;
    Console.Write(&amp;quot;Here is nums2 after assignment: &amp;quot;); &lt;br /&gt;
    for(i=0; i &amp;lt; 10; i++) &lt;br /&gt;
      Console.Write(nums2[i] + &amp;quot; &amp;quot;);   &lt;br /&gt;
    Console.WriteLine(); &lt;br /&gt;
  }  &lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;pre class=codeResult&amp;gt;Here is nums1: 0 1 2 3 4 5 6 7 8 9 Here is nums2: 0 -1 -2 -3 -4 -5 -6 -7 -8 -9&lt;br /&gt;
Here is nums2 after assignment: 0 1 2 3 4 5 6 7 8 9&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Demonstrate an array overrun==&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 MainClass {  &lt;br /&gt;
  public static void Main() {  &lt;br /&gt;
    int[] sample = new int[10]; &lt;br /&gt;
    int i;  &lt;br /&gt;
  &lt;br /&gt;
    // generate an array overrun &lt;br /&gt;
    for(i = 0; i &amp;lt; 100; i = i+1)  &lt;br /&gt;
      sample[i] = i; &lt;br /&gt;
  }  &lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;pre class=codeResult&amp;gt;Unhandled Exception: System.IndexOutOfRangeException: Index was outside the bounds of the array.&lt;br /&gt;
   at MainClass.Main()&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Set array element value by index(subscript)==&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 MainClass {  &lt;br /&gt;
  public static void Main() {  &lt;br /&gt;
    int[] nums = new int[10]; &lt;br /&gt;
    int avg = 0; &lt;br /&gt;
 &lt;br /&gt;
    nums[0] = 99; &lt;br /&gt;
    nums[1] = 10; &lt;br /&gt;
    nums[2] = 100; &lt;br /&gt;
    nums[3] = 18; &lt;br /&gt;
    nums[4] = 78; &lt;br /&gt;
    nums[5] = 23; &lt;br /&gt;
    nums[6] = 63; &lt;br /&gt;
    nums[7] = 9; &lt;br /&gt;
    nums[8] = 87; &lt;br /&gt;
    nums[9] = 49; &lt;br /&gt;
 &lt;br /&gt;
    for(int i=0; i &amp;lt; 10; i++)  &lt;br /&gt;
      avg = avg + nums[i]; &lt;br /&gt;
 &lt;br /&gt;
    avg = avg / 10; &lt;br /&gt;
 &lt;br /&gt;
    Console.WriteLine(&amp;quot;Average: &amp;quot; + avg); &lt;br /&gt;
  }  &lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;pre class=codeResult&amp;gt;Average: 53&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Swapping Data between Positions in an Array==&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;
    string[] languages = new string[9]{&amp;quot;C#&amp;quot;, &amp;quot;COBOL&amp;quot;, &amp;quot;Java&amp;quot;,&amp;quot;C++&amp;quot;};&lt;br /&gt;
    string language = languages[3];&lt;br /&gt;
    languages[3] = languages[2];&lt;br /&gt;
    languages[2] = language;&lt;br /&gt;
  }&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Use the IndexOf() and LastIndexOf() methods to find the string &amp;quot;Hello&amp;quot;  in stringArray==&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;
  public static void Main()&lt;br /&gt;
  {&lt;br /&gt;
    string[] stringArray = {&amp;quot;Hello&amp;quot;, &amp;quot;to&amp;quot;, &amp;quot;everyone&amp;quot;, &amp;quot;Hello&amp;quot;, &amp;quot;all&amp;quot;};&lt;br /&gt;
    Console.WriteLine(&amp;quot;stringArray:&amp;quot;);&lt;br /&gt;
    for (int i = 0; i &amp;lt; stringArray.Length; i++)&lt;br /&gt;
    {&lt;br /&gt;
      Console.WriteLine(&amp;quot;stringArray[&amp;quot; + i + &amp;quot;] = &amp;quot; + stringArray[i]);&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    int index = Array.IndexOf(stringArray, &amp;quot;Hello&amp;quot;);&lt;br /&gt;
    Console.WriteLine(&amp;quot;Array.IndexOf(stringArray, \&amp;quot;Hello\&amp;quot;) = &amp;quot; + index);&lt;br /&gt;
    index = Array.LastIndexOf(stringArray, &amp;quot;Hello&amp;quot;);&lt;br /&gt;
    Console.WriteLine(&amp;quot;Array.LastIndexOf(stringArray, \&amp;quot;Hello\&amp;quot;) = &amp;quot; + index);&lt;br /&gt;
  }&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;pre class=codeResult&amp;gt;stringArray:&lt;br /&gt;
stringArray[0] = Hello&lt;br /&gt;
stringArray[1] = to&lt;br /&gt;
stringArray[2] = everyone&lt;br /&gt;
stringArray[3] = Hello&lt;br /&gt;
stringArray[4] = all&lt;br /&gt;
Array.IndexOf(stringArray, &amp;quot;Hello&amp;quot;) = 0&lt;br /&gt;
Array.LastIndexOf(stringArray, &amp;quot;Hello&amp;quot;) = 3&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Use the IndexOf() and LastIndexOf() methods to find the value 1 in intArray==&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;
  public static void Main()&lt;br /&gt;
  {&lt;br /&gt;
    int[] intArray = {1, 2, 1, 3};&lt;br /&gt;
    Console.WriteLine(&amp;quot;intArray:&amp;quot;);&lt;br /&gt;
    for (int i = 0; i &amp;lt; intArray.Length; i++)&lt;br /&gt;
    {&lt;br /&gt;
      Console.WriteLine(&amp;quot;intArray[&amp;quot; + i + &amp;quot;] = &amp;quot; +&lt;br /&gt;
        intArray[i]);&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    int index = Array.IndexOf(intArray, 1);&lt;br /&gt;
    Console.WriteLine(&amp;quot;Array.IndexOf(intArray, 1) = &amp;quot; + index);&lt;br /&gt;
    index = Array.LastIndexOf(intArray, 1);&lt;br /&gt;
    Console.WriteLine(&amp;quot;Array.LastIndexOf(intArray, 1) = &amp;quot; + index);&lt;br /&gt;
  }&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;pre class=codeResult&amp;gt;intArray:&lt;br /&gt;
intArray[0] = 1&lt;br /&gt;
intArray[1] = 2&lt;br /&gt;
intArray[2] = 1&lt;br /&gt;
intArray[3] = 3&lt;br /&gt;
Array.IndexOf(intArray, 1) = 0&lt;br /&gt;
Array.LastIndexOf(intArray, 1) = 2&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Admin</name></author>	</entry>

	</feed>