a==bの評価
using namespace System; ref class C { int i; }; delegate void mydelegate(); void func() { return; } int main(array<System::String ^> ^args) { String^ a = "aaa"; String^ b = "aaa"; Object^ o = "aaa"; C^ c = gcnew C; mydelegate^ d1 = gcnew mydelegate(func); mydelegate^ d2 = gcnew mydelegate(func); if ( a == b ) // true Console::WriteLine(L"Hello World"); if ( d1 == d2 ) // true Console::WriteLine(L"Hello World"); if ( a == o ) // false Console::WriteLine(L"Hello World"); if ( a == "aaa" ) // true Console::WriteLine(L"Hello World"); if ( a == L"aaa" ) // true Console::WriteLine(L"Hello World"); char* p1 = "aaa"; int i=0; // if ( a == p1 ) // compile error // if ( o == p1 ) // compile error // if ( a == 0 ) // compile error // if ( c == 0 ) // compile error if ( o == 0 ) // false Console::WriteLine(L"Hello World"); if ( o == i ) // false Console::WriteLine(L"Hello World"); Object^ oi = 0; if ( oi == 0 ) // false Console::WriteLine(L"Hello World"); // if ( o == p1 ) // compile error if ( "aaa" == "aaa" ) // same as c++, undefined. Console::WriteLine(L"Hello World"); return 0; }