<?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=Visual_C%2B%2B_.NET%2FCollections%2FArray</id>
		<title>Visual C++ .NET/Collections/Array - История изменений</title>
		<link rel="self" type="application/atom+xml" href="http://nfex.ru/index.php?action=history&amp;feed=atom&amp;title=Visual_C%2B%2B_.NET%2FCollections%2FArray"/>
		<link rel="alternate" type="text/html" href="http://nfex.ru/index.php?title=Visual_C%2B%2B_.NET/Collections/Array&amp;action=history"/>
		<updated>2026-04-30T05:25:39Z</updated>
		<subtitle>История изменений этой страницы в вики</subtitle>
		<generator>MediaWiki 1.30.0</generator>

	<entry>
		<id>http://nfex.ru/index.php?title=Visual_C%2B%2B_.NET/Collections/Array&amp;diff=3560&amp;oldid=prev</id>
		<title> в 15:31, 26 мая 2010</title>
		<link rel="alternate" type="text/html" href="http://nfex.ru/index.php?title=Visual_C%2B%2B_.NET/Collections/Array&amp;diff=3560&amp;oldid=prev"/>
				<updated>2010-05-26T15:31:02Z</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=Visual_C%2B%2B_.NET/Collections/Array&amp;diff=3561&amp;oldid=prev</id>
		<title>Admin: 1 версия</title>
		<link rel="alternate" type="text/html" href="http://nfex.ru/index.php?title=Visual_C%2B%2B_.NET/Collections/Array&amp;diff=3561&amp;oldid=prev"/>
				<updated>2010-05-26T12:05:23Z</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;==Array equality test==&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;
#include &amp;quot;stdafx.h&amp;quot;&lt;br /&gt;
using namespace System;&lt;br /&gt;
&lt;br /&gt;
bool ReallyEquals(array&amp;lt;int&amp;gt;^ a, array&amp;lt;int&amp;gt;^ b){&lt;br /&gt;
   if (a-&amp;gt;Length != b-&amp;gt;Length)&lt;br /&gt;
       return false;&lt;br /&gt;
   for (int i = 0; i &amp;lt; a-&amp;gt;Length; i++)&lt;br /&gt;
   {&lt;br /&gt;
       if (a[i] != b[i]) return false;&lt;br /&gt;
   }&lt;br /&gt;
   return true;&lt;br /&gt;
}&lt;br /&gt;
int main()&lt;br /&gt;
{&lt;br /&gt;
   array&amp;lt;int&amp;gt;^ ai1 = gcnew array&amp;lt;int&amp;gt; { 1, 2 };&lt;br /&gt;
   array&amp;lt;int&amp;gt;^ ai2 = gcnew array&amp;lt;int&amp;gt; { 1, 2 };&lt;br /&gt;
   if ( ai1 == ai2 )&lt;br /&gt;
   {&lt;br /&gt;
       Console::WriteLine(&amp;quot;The arrays are equal using the == operator.&amp;quot;);&lt;br /&gt;
   }&lt;br /&gt;
   if (ai1-&amp;gt;Equals(ai2) )&lt;br /&gt;
   {&lt;br /&gt;
       Console::WriteLine(&amp;quot;The arrays are equal using the Equals method.&amp;quot;);&lt;br /&gt;
   }&lt;br /&gt;
   if (ReallyEquals(ai1, ai2))&lt;br /&gt;
   {&lt;br /&gt;
       Console::WriteLine(&lt;br /&gt;
        &amp;quot;The arrays are equal using element-by-element comparison.&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;
==Array for each==&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;
#include &amp;quot;stdafx.h&amp;quot;&lt;br /&gt;
using namespace System;&lt;br /&gt;
int main()&lt;br /&gt;
{&lt;br /&gt;
   array&amp;lt;String^&amp;gt;^ stringArray = gcnew array&amp;lt;String^&amp;gt;&lt;br /&gt;
       { &amp;quot;one&amp;quot;, &amp;quot;two&amp;quot;, &amp;quot;three&amp;quot;, &amp;quot;four&amp;quot;, &amp;quot;five&amp;quot; };&lt;br /&gt;
   for each (String^ str in stringArray)&lt;br /&gt;
   {&lt;br /&gt;
      Console::WriteLine(str);&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;
==Array initialization without gcnew==&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;
#include &amp;quot;stdafx.h&amp;quot;&lt;br /&gt;
int main()&lt;br /&gt;
{&lt;br /&gt;
   array&amp;lt;int&amp;gt;^ array_int1 = { 0, 1, 2 };&lt;br /&gt;
   array&amp;lt;int&amp;gt;^ array_int2 = gcnew array&amp;lt;int&amp;gt; { 0, 1, 2 };&lt;br /&gt;
&lt;br /&gt;
   int i = 1, j = 2, k = 3;&lt;br /&gt;
   array&amp;lt;int&amp;gt;^ array_int3 = { i, j, k };&lt;br /&gt;
}&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Array initializing==&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;
#include &amp;quot;stdafx.h&amp;quot;&lt;br /&gt;
int main()&lt;br /&gt;
{&lt;br /&gt;
   array&amp;lt;int&amp;gt;^ array_int1 = { 0, 1, 2 };&lt;br /&gt;
   array&amp;lt;int&amp;gt;^ array_int2 = gcnew array&amp;lt;int&amp;gt; { 0, 1, 2 };&lt;br /&gt;
&lt;br /&gt;
   int i = 1, j = 2, k = 3;&lt;br /&gt;
   array&amp;lt;int&amp;gt;^ array_int3 = { i, j, k };&lt;br /&gt;
}&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Arrays iterators==&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;
#include &amp;quot;stdafx.h&amp;quot;&lt;br /&gt;
using namespace System;&lt;br /&gt;
using namespace System::Collections;&lt;br /&gt;
int main()&lt;br /&gt;
{&lt;br /&gt;
   array&amp;lt;DateTime^&amp;gt;^ dateArray = gcnew array&amp;lt;DateTime^&amp;gt;(2);&lt;br /&gt;
   dateArray[0] = gcnew DateTime(1970, 12, 18);&lt;br /&gt;
   dateArray[1] = gcnew DateTime(1990, 1, 5);&lt;br /&gt;
   IEnumerator^ enumerator1 = dateArray-&amp;gt;GetEnumerator();&lt;br /&gt;
   while ( enumerator1-&amp;gt;MoveNext() )&lt;br /&gt;
   {&lt;br /&gt;
      DateTime^ current = (DateTime^) enumerator1-&amp;gt;Current;&lt;br /&gt;
      Console::WriteLine( current-&amp;gt;ToString(&amp;quot;MM/dd/yyyy&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;
==Assign value from native array to managed array==&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;
#include &amp;quot;stdafx.h&amp;quot;&lt;br /&gt;
#include &amp;lt;iostream&amp;gt;&lt;br /&gt;
using namespace std;&lt;br /&gt;
int main()&lt;br /&gt;
{&lt;br /&gt;
   int nativeArray[10];&lt;br /&gt;
   array&amp;lt;int&amp;gt;^ managedArray = gcnew array&amp;lt;int&amp;gt;(10);&lt;br /&gt;
   for (int i = 0; i &amp;lt; 10; i++)&lt;br /&gt;
   {&lt;br /&gt;
      nativeArray[i] = i*i;&lt;br /&gt;
      cout &amp;lt;&amp;lt; nativeArray[i] &amp;lt;&amp;lt; &amp;quot; &amp;quot;;&lt;br /&gt;
      managedArray[i] = nativeArray[i];&lt;br /&gt;
      cout &amp;lt;&amp;lt; managedArray[i] &amp;lt;&amp;lt; &amp;quot; &amp;quot;;&lt;br /&gt;
   }&lt;br /&gt;
   cout &amp;lt;&amp;lt; endl;&lt;br /&gt;
}&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==class with managed array==&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;
#include &amp;quot;stdafx.h&amp;quot;&lt;br /&gt;
ref class MyClass&lt;br /&gt;
{&lt;br /&gt;
   private:&lt;br /&gt;
      array&amp;lt;double&amp;gt;^ pos;  // declare the managed array&lt;br /&gt;
      unsigned int a;&lt;br /&gt;
      unsigned int b;&lt;br /&gt;
   public:&lt;br /&gt;
       MyClass()&lt;br /&gt;
       {&lt;br /&gt;
           pos = gcnew array&amp;lt;double&amp;gt;(3);&lt;br /&gt;
           pos[0] = 0; pos[1] = 0; pos[2] = 0;&lt;br /&gt;
           a = 1;&lt;br /&gt;
           b = 1;&lt;br /&gt;
       }&lt;br /&gt;
       MyClass(double x, double y, double z, unsigned int atNo, unsigned int n): a(atNo), b(n)&lt;br /&gt;
       {&lt;br /&gt;
          pos = gcnew array&amp;lt;double&amp;gt;(3);&lt;br /&gt;
          pos[0] = x; pos[1] = y; pos[2] = z;&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;
==Create an interior pointer to elements of the array==&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;
#include &amp;quot;stdafx.h&amp;quot;&lt;br /&gt;
using namespace System;&lt;br /&gt;
ref class MyObject&lt;br /&gt;
{&lt;br /&gt;
};&lt;br /&gt;
int main()&lt;br /&gt;
{&lt;br /&gt;
   array&amp;lt;MyObject^&amp;gt;^ array_of_buf = gcnew array&amp;lt;MyObject^&amp;gt;(10);&lt;br /&gt;
   for each (MyObject^ bref in array_of_buf)&lt;br /&gt;
   {&lt;br /&gt;
      bref = gcnew MyObject();&lt;br /&gt;
   }&lt;br /&gt;
   interior_ptr&amp;lt;MyObject^&amp;gt; ptr_buf;&lt;br /&gt;
   for (ptr_buf = &amp;amp;array_of_buf[0]; ptr_buf &amp;lt;= &amp;amp;array_of_buf[9]; ptr_buf++)&lt;br /&gt;
   {&lt;br /&gt;
      MyObject^ buf = *ptr_buf;&lt;br /&gt;
      // use the MyObject class&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;
==Create an object for each object array position==&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;
#include &amp;quot;stdafx.h&amp;quot;&lt;br /&gt;
using namespace System;&lt;br /&gt;
ref class MyObject&lt;br /&gt;
{&lt;br /&gt;
};&lt;br /&gt;
int main()&lt;br /&gt;
{&lt;br /&gt;
   array&amp;lt;MyObject^&amp;gt;^ array_of_buf = gcnew array&amp;lt;MyObject^&amp;gt;(10);&lt;br /&gt;
   for each (MyObject^ bref in array_of_buf)&lt;br /&gt;
   {&lt;br /&gt;
      bref = gcnew MyObject();&lt;br /&gt;
   }&lt;br /&gt;
   interior_ptr&amp;lt;MyObject^&amp;gt; ptr_buf;&lt;br /&gt;
   for (ptr_buf = &amp;amp;array_of_buf[0]; ptr_buf &amp;lt;= &amp;amp;array_of_buf[9]; ptr_buf++)&lt;br /&gt;
   {&lt;br /&gt;
      MyObject^ buf = *ptr_buf;&lt;br /&gt;
      // use the MyObject class&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;
==Declare, create, and initialize a 1D managed array==&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;
#include &amp;quot;stdafx.h&amp;quot;&lt;br /&gt;
int main()&lt;br /&gt;
{&lt;br /&gt;
   array&amp;lt;int&amp;gt;^ managed_array = gcnew array&amp;lt;int&amp;gt;(2) { 10, 20 };&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;
==Declare, create, and initialize a 1D native array==&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;
#include &amp;quot;stdafx.h&amp;quot;&lt;br /&gt;
int main()&lt;br /&gt;
{&lt;br /&gt;
   int native_array[2] = { 10, 20 };&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;
==Declare, create, and initialize a 2D managed array==&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;
#include &amp;quot;stdafx.h&amp;quot;&lt;br /&gt;
int main()&lt;br /&gt;
{&lt;br /&gt;
   array&amp;lt;int, 2&amp;gt;^ managed_array_2D = gcnew array&amp;lt;int, 2&amp;gt;(2, 2)&lt;br /&gt;
                    { { 1, 0 }, { 0, 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;
==Declare, create, and initialize a 2D native array==&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;
#include &amp;quot;stdafx.h&amp;quot;&lt;br /&gt;
int main()&lt;br /&gt;
{&lt;br /&gt;
   int native_array_2D[2][2] = { { 1, 0 }, { 0, 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;
==Get array length==&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;
#include &amp;quot;stdafx.h&amp;quot;&lt;br /&gt;
using namespace System;&lt;br /&gt;
int main()&lt;br /&gt;
{&lt;br /&gt;
   array&amp;lt;String^&amp;gt;^ stringArray = gcnew array&amp;lt;String^&amp;gt;(5){ &amp;quot;one&amp;quot;, &amp;quot;two&amp;quot; };&lt;br /&gt;
   for (int i = 0; i &amp;lt; stringArray-&amp;gt;Length; i++)&lt;br /&gt;
   {&lt;br /&gt;
      Console::WriteLine( stringArray[i] );&lt;br /&gt;
   }&lt;br /&gt;
   Console::WriteLine(&amp;quot;End.&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;
==Loop over the array with the interior pointer==&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;
#include &amp;quot;stdafx.h&amp;quot;&lt;br /&gt;
using namespace System;&lt;br /&gt;
ref class MyObject&lt;br /&gt;
{&lt;br /&gt;
};&lt;br /&gt;
int main()&lt;br /&gt;
{&lt;br /&gt;
   array&amp;lt;MyObject^&amp;gt;^ array_of_buf = gcnew array&amp;lt;MyObject^&amp;gt;(10);&lt;br /&gt;
   for each (MyObject^ bref in array_of_buf)&lt;br /&gt;
   {&lt;br /&gt;
      bref = gcnew MyObject();&lt;br /&gt;
   }&lt;br /&gt;
   interior_ptr&amp;lt;MyObject^&amp;gt; ptr_buf;&lt;br /&gt;
   for (ptr_buf = &amp;amp;array_of_buf[0]; ptr_buf &amp;lt;= &amp;amp;array_of_buf[9]; ptr_buf++)&lt;br /&gt;
   {&lt;br /&gt;
      MyObject^ buf = *ptr_buf;&lt;br /&gt;
      // use the MyObject class&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;
==Object array with non default constrctuctor==&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;
#include &amp;quot;stdafx.h&amp;quot;&lt;br /&gt;
using namespace System;&lt;br /&gt;
ref class C&lt;br /&gt;
{&lt;br /&gt;
   public:&lt;br /&gt;
      C(int i) { Value = i; }&lt;br /&gt;
      property int Value;&lt;br /&gt;
};&lt;br /&gt;
int main()&lt;br /&gt;
{&lt;br /&gt;
   array&amp;lt;C^&amp;gt;^ array_C = { gcnew C(0), gcnew C(1), gcnew C(2)};&lt;br /&gt;
   Console::WriteLine( &amp;quot; {0}, {1}, {2} &amp;quot;, array_C[0]-&amp;gt;Value,&lt;br /&gt;
                  array_C[1]-&amp;gt;Value, array_C[2]-&amp;gt;Value);&lt;br /&gt;
}&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Shallow copy creates another name for the array==&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;
#include &amp;quot;stdafx.h&amp;quot;&lt;br /&gt;
using namespace System;&lt;br /&gt;
int main()&lt;br /&gt;
{&lt;br /&gt;
   array&amp;lt;int&amp;gt;^ array1 = { 0, 1, 2};&lt;br /&gt;
&lt;br /&gt;
   array&amp;lt;int&amp;gt;^ array2 = array1;&lt;br /&gt;
}&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Single dimension Arrays==&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;
#include &amp;quot;stdafx.h&amp;quot;&lt;br /&gt;
using namespace System;&lt;br /&gt;
void main()&lt;br /&gt;
{&lt;br /&gt;
    array&amp;lt;int&amp;gt;^ a = gcnew array&amp;lt;int&amp;gt;(4);&lt;br /&gt;
    array&amp;lt;String^&amp;gt;^ b = gcnew array&amp;lt;String^&amp;gt;(4);&lt;br /&gt;
    for (int i = 0; i &amp;lt; a-&amp;gt;Length; i++)&lt;br /&gt;
    {&lt;br /&gt;
        a[i] = i;&lt;br /&gt;
    }&lt;br /&gt;
    for (int i = 0; i &amp;lt; b-&amp;gt;Length; i++)&lt;br /&gt;
    {&lt;br /&gt;
        b[i] = a[i].ToString();&lt;br /&gt;
    }&lt;br /&gt;
    for (int i = 0; i &amp;lt; b-&amp;gt;Length; i++)&lt;br /&gt;
    {&lt;br /&gt;
        Console::WriteLine(b[i]);&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;
==Sort array with Array.Sort==&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;
#include &amp;quot;stdafx.h&amp;quot;&lt;br /&gt;
using namespace System;&lt;br /&gt;
int main()&lt;br /&gt;
{&lt;br /&gt;
   array&amp;lt;int&amp;gt;^ array1 = gcnew array&amp;lt;int&amp;gt;(10){ 2, 7, 9, 6, 4, 1, 9, 5, 0, 10 };&lt;br /&gt;
   Array::Sort(array1);&lt;br /&gt;
   for each (int i in array1)&lt;br /&gt;
   {&lt;br /&gt;
      Console::Write(&amp;quot;{0} &amp;quot;, i);&lt;br /&gt;
   }&lt;br /&gt;
   // Search for one of the values&lt;br /&gt;
   int index = Array::BinarySearch( array1, 115);&lt;br /&gt;
   if (index &amp;gt;= 0 )&lt;br /&gt;
      Console::WriteLine( &amp;quot;Found {0} at position {1}.&amp;quot;, array1[index], index );&lt;br /&gt;
   else&lt;br /&gt;
      Console::WriteLine(&amp;quot; Not Found. &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;
==String arrays length==&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;
#include &amp;quot;stdafx.h&amp;quot;&lt;br /&gt;
using namespace System;&lt;br /&gt;
int main()&lt;br /&gt;
{&lt;br /&gt;
   array&amp;lt;String^&amp;gt;^ string_array = gcnew array&amp;lt;String^&amp;gt;(2) { &amp;quot;first&amp;quot;, &amp;quot;second&amp;quot; } ;&lt;br /&gt;
   for (int i = 0; i &amp;lt; string_array-&amp;gt;Length; i++)&lt;br /&gt;
   {&lt;br /&gt;
      Console::WriteLine( string_array[i] );&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 variables in the initializer list==&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;
#include &amp;quot;stdafx.h&amp;quot;&lt;br /&gt;
int main()&lt;br /&gt;
{&lt;br /&gt;
   array&amp;lt;int&amp;gt;^ array_int1 = { 0, 1, 2 };&lt;br /&gt;
   array&amp;lt;int&amp;gt;^ array_int2 = gcnew array&amp;lt;int&amp;gt; { 0, 1, 2 };&lt;br /&gt;
&lt;br /&gt;
   int i = 1, j = 2, k = 3;&lt;br /&gt;
   array&amp;lt;int&amp;gt;^ array_int3 = { i, j, k };&lt;br /&gt;
}&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Using Array.BinarySearch to search an element 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; &lt;br /&gt;
#include &amp;quot;stdafx.h&amp;quot;&lt;br /&gt;
using namespace System;&lt;br /&gt;
int main()&lt;br /&gt;
{&lt;br /&gt;
   array&amp;lt;int&amp;gt;^ array1 = gcnew array&amp;lt;int&amp;gt;(10){ 2, 7, 9, 6, 4, 1, 9, 5, 0, 10 };&lt;br /&gt;
   Array::Sort(array1);&lt;br /&gt;
   for each (int i in array1)&lt;br /&gt;
   {&lt;br /&gt;
      Console::Write(&amp;quot;{0} &amp;quot;, i);&lt;br /&gt;
   }&lt;br /&gt;
   // Search for one of the values&lt;br /&gt;
   int index = Array::BinarySearch( array1, 115);&lt;br /&gt;
   if (index &amp;gt;= 0 )&lt;br /&gt;
      Console::WriteLine( &amp;quot;Found {0} at position {1}.&amp;quot;, array1[index], index );&lt;br /&gt;
   else&lt;br /&gt;
      Console::WriteLine(&amp;quot; Not Found. &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;
==Using Array::Copy to copy array==&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;
#include &amp;quot;stdafx.h&amp;quot;&lt;br /&gt;
using namespace System;&lt;br /&gt;
int main()&lt;br /&gt;
{&lt;br /&gt;
   array&amp;lt;int&amp;gt;^ array1 = { 0, 1, 2};&lt;br /&gt;
&lt;br /&gt;
   array&amp;lt;int&amp;gt;^ array2 = array1;&lt;br /&gt;
   array&amp;lt;int&amp;gt;^ array3 = gcnew array&amp;lt;int&amp;gt;(3);&lt;br /&gt;
   Array::Copy(array1, array3, array1-&amp;gt;Length);&lt;br /&gt;
   array3[0] = 200;&lt;br /&gt;
   Console::WriteLine( &amp;quot;{0} {1} {2}&amp;quot;, array1[0], array1[1], array1[2]);&lt;br /&gt;
}&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Using array.Equals to test if two arrays are equal==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
1.&lt;br /&gt;
&amp;lt;A href=&amp;quot;/Code/Cpp.net/Collections/SingledimensionArrays.htm&amp;quot;&amp;gt;Single dimension Arrays&amp;lt;/a&amp;gt;&lt;br /&gt;
2.&lt;br /&gt;
&amp;lt;A href=&amp;quot;/Code/Cpp.net/Collections/Usinggcnewtocreatearray.htm&amp;quot;&amp;gt;Using gcnew to create array&amp;lt;/a&amp;gt;&lt;br /&gt;
3.&lt;br /&gt;
&amp;lt;A href=&amp;quot;/Code/Cpp.net/Collections/Declarecreateandinitializea1Dnativearray.htm&amp;quot;&amp;gt;Declare, create, and initialize a 1D native array&amp;lt;/a&amp;gt;&lt;br /&gt;
4.&lt;br /&gt;
&amp;lt;A href=&amp;quot;/Code/Cpp.net/Collections/Declarecreateandinitializea1Dmanagedarray.htm&amp;quot;&amp;gt;Declare, create, and initialize a 1D managed array&amp;lt;/a&amp;gt;&lt;br /&gt;
5.&lt;br /&gt;
&amp;lt;A href=&amp;quot;/Code/Cpp.net/Collections/Declarecreateandinitializea2Dnativearray.htm&amp;quot;&amp;gt;Declare, create, and initialize a 2D native array&amp;lt;/a&amp;gt;&lt;br /&gt;
6.&lt;br /&gt;
&amp;lt;A href=&amp;quot;/Code/Cpp.net/Collections/Declarecreateandinitializea2Dmanagedarray.htm&amp;quot;&amp;gt;Declare, create, and initialize a 2D managed array&amp;lt;/a&amp;gt;&lt;br /&gt;
7.&lt;br /&gt;
&amp;lt;A href=&amp;quot;/Code/Cpp.net/Collections/Arrayinitializing.htm&amp;quot;&amp;gt;Array initializing&amp;lt;/a&amp;gt;&lt;br /&gt;
8.&lt;br /&gt;
&amp;lt;A href=&amp;quot;/Code/Cpp.net/Collections/Arrayforeach.htm&amp;quot;&amp;gt;Array for each&amp;lt;/a&amp;gt;&lt;br /&gt;
9.&lt;br /&gt;
&amp;lt;A href=&amp;quot;/Code/Cpp.net/Collections/Shallowcopycreatesanothernameforthearray.htm&amp;quot;&amp;gt;Shallow copy creates another name for the array&amp;lt;/a&amp;gt;&lt;br /&gt;
10.&lt;br /&gt;
&amp;lt;A href=&amp;quot;/Code/Cpp.net/Collections/UsingArrayCopytocopyarray.htm&amp;quot;&amp;gt;Using Array::Copy to copy array&amp;lt;/a&amp;gt;&lt;br /&gt;
11.&lt;br /&gt;
&amp;lt;A href=&amp;quot;/Code/Cpp.net/Collections/Arrayequalitytest.htm&amp;quot;&amp;gt;Array equality test&amp;lt;/a&amp;gt;&lt;br /&gt;
12.&lt;br /&gt;
&amp;lt;A href=&amp;quot;/Code/Cpp.net/Collections/classwithmanagedarray.htm&amp;quot;&amp;gt;class with managed array&amp;lt;/a&amp;gt;&lt;br /&gt;
13.&lt;br /&gt;
&amp;lt;A href=&amp;quot;/Code/Cpp.net/Collections/Getarraylength.htm&amp;quot;&amp;gt;Get array length&amp;lt;/a&amp;gt;&lt;br /&gt;
14.&lt;br /&gt;
&amp;lt;A href=&amp;quot;/Code/Cpp.net/Collections/SortarraywithArraySort.htm&amp;quot;&amp;gt;Sort array with Array.Sort&amp;lt;/a&amp;gt;&lt;br /&gt;
15.&lt;br /&gt;
&amp;lt;A href=&amp;quot;/Code/Cpp.net/Collections/UsingArrayBinarySearchtosearchanelementinanarray.htm&amp;quot;&amp;gt;Using Array.BinarySearch to search an element in an array&amp;lt;/a&amp;gt;&lt;br /&gt;
16.&lt;br /&gt;
&amp;lt;A href=&amp;quot;/Code/Cpp.net/Collections/Usingforeachtoloopthroughanarray.htm&amp;quot;&amp;gt;Using for each to loop through an array&amp;lt;/a&amp;gt;&lt;br /&gt;
17.&lt;br /&gt;
&amp;lt;A href=&amp;quot;/Code/Cpp.net/Collections/Arraysiterators.htm&amp;quot;&amp;gt;Arrays iterators&amp;lt;/a&amp;gt;&lt;br /&gt;
18.&lt;br /&gt;
&amp;lt;A href=&amp;quot;/Code/Cpp.net/Collections/Createanobjectforeachobjectarrayposition.htm&amp;quot;&amp;gt;Create an object for each object array position&amp;lt;/a&amp;gt;&lt;br /&gt;
19.&lt;br /&gt;
&amp;lt;A href=&amp;quot;/Code/Cpp.net/Collections/Loopoverthearraywiththeinteriorpointer.htm&amp;quot;&amp;gt;Loop over the array with the interior pointer&amp;lt;/a&amp;gt;&lt;br /&gt;
20.&lt;br /&gt;
&amp;lt;A href=&amp;quot;/Code/Cpp.net/Collections/Createaninteriorpointertoelementsofthearray.htm&amp;quot;&amp;gt;Create an interior pointer to elements of the array&amp;lt;/a&amp;gt;&lt;br /&gt;
21.&lt;br /&gt;
&amp;lt;A href=&amp;quot;/Code/Cpp.net/Collections/Arrayinitializationwithoutgcnew.htm&amp;quot;&amp;gt;Array initialization without gcnew&amp;lt;/a&amp;gt;&lt;br /&gt;
22.&lt;br /&gt;
&amp;lt;A href=&amp;quot;/Code/Cpp.net/Collections/Usinggcnewtocreatearray.htm&amp;quot;&amp;gt;Using gcnew to create array&amp;lt;/a&amp;gt;&lt;br /&gt;
23.&lt;br /&gt;
&amp;lt;A href=&amp;quot;/Code/Cpp.net/Collections/Objectarraywithnondefaultconstrctuctor.htm&amp;quot;&amp;gt;Object array with non default constrctuctor&amp;lt;/a&amp;gt;&lt;br /&gt;
24.&lt;br /&gt;
&amp;lt;A href=&amp;quot;/Code/Cpp.net/Collections/Assignvaluefromnativearraytomanagedarray.htm&amp;quot;&amp;gt;Assign value from native array to managed array&amp;lt;/a&amp;gt;&lt;br /&gt;
25.&lt;br /&gt;
&amp;lt;A href=&amp;quot;/Code/Cpp.net/Collections/Stringarrayslength.htm&amp;quot;&amp;gt;String arrays length&amp;lt;/a&amp;gt;&lt;br /&gt;
26.&lt;br /&gt;
&amp;lt;A href=&amp;quot;/Code/Cpp.net/Collections/Usevariablesintheinitializerlist.htm&amp;quot;&amp;gt;Use variables in the initializer list&amp;lt;/a&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Using for each to loop through 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; &lt;br /&gt;
#include &amp;quot;stdafx.h&amp;quot;&lt;br /&gt;
using namespace System;&lt;br /&gt;
int main()&lt;br /&gt;
{&lt;br /&gt;
   array&amp;lt;int&amp;gt;^ array1 = gcnew array&amp;lt;int&amp;gt;(10){ 2, 7, 9, 6, 4, 1, 9, 5, 0, 10 };&lt;br /&gt;
   Array::Sort(array1);&lt;br /&gt;
   for each (int i in array1)&lt;br /&gt;
   {&lt;br /&gt;
      Console::Write(&amp;quot;{0} &amp;quot;, i);&lt;br /&gt;
   }&lt;br /&gt;
   // Search for one of the values&lt;br /&gt;
   int index = Array::BinarySearch( array1, 115);&lt;br /&gt;
   if (index &amp;gt;= 0 )&lt;br /&gt;
      Console::WriteLine( &amp;quot;Found {0} at position {1}.&amp;quot;, array1[index], index );&lt;br /&gt;
   else&lt;br /&gt;
      Console::WriteLine(&amp;quot; Not Found. &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;
==Using gcnew to create array==&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;
#include &amp;quot;stdafx.h&amp;quot;&lt;br /&gt;
using namespace System;&lt;br /&gt;
int main()&lt;br /&gt;
{&lt;br /&gt;
   array&amp;lt;String^&amp;gt;^ stringArray = gcnew array&amp;lt;String^&amp;gt;(5){ &amp;quot;one&amp;quot;, &amp;quot;two&amp;quot; };&lt;br /&gt;
   for (int i = 0; i &amp;lt; stringArray-&amp;gt;Length; i++)&lt;br /&gt;
   {&lt;br /&gt;
      Console::WriteLine( stringArray[i] );&lt;br /&gt;
   }&lt;br /&gt;
   Console::WriteLine(&amp;quot;End.&amp;quot;);&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>