#include "stdafx.h"
using namespace System;
int main()
{
String^ str1 = "1";
String^ str2 = "1";
String^ str3 = str1;
if (str1 == str2)
{
Console::WriteLine(" str1 == str2" );
}
if (str1 == str3)
{
Console::WriteLine(" str1 == str3" );
}
if (str1->Equals(str2))
{
Console::WriteLine(" str1 Equals str2" );
}
if (str1->Equals(str3))
{
Console::WriteLine(" str1 Equals str3");
}
if (String::ReferenceEquals(str1, str2))
{
Console::WriteLine(" str1 ReferenceEquals str2");
}
if (String::ReferenceEquals(str1, str3))
{
Console::WriteLine(" str1 ReferenceEquals str3");
}
}
|