#include "stdafx.h"
using namespace System;
bool ReallyEquals(array^ a, array^ b){
if (a->Length != b->Length)
return false;
for (int i = 0; i < a->Length; i++)
{
if (a[i] != b[i]) return false;
}
return true;
}
int main()
{
array^ ai1 = gcnew array { 1, 2 };
array^ ai2 = gcnew array { 1, 2 };
if ( ai1 == ai2 )
{
Console::WriteLine("The arrays are equal using the == operator.");
}
if (ai1->Equals(ai2) )
{
Console::WriteLine("The arrays are equal using the Equals method.");
}
if (ReallyEquals(ai1, ai2))
{
Console::WriteLine(
"The arrays are equal using element-by-element comparison.");
}
}