UTF32Encoding.Equals(Object) 메서드

정의

지정한 Object이(가) 현재 UTF32Encoding 개체와 같은지 여부를 확인합니다.

public:
 override bool Equals(System::Object ^ value);
public override bool Equals (object value);
public override bool Equals (object? value);
override this.Equals : obj -> bool
Public Overrides Function Equals (value As Object) As Boolean

매개 변수

value
Object

현재 개체와 비교할 Object입니다.

반환

Boolean

valueUTF32Encoding 인스턴스이고 현재 개체와 같으면 true이고, 그렇지 않으면 false입니다.

예제

다음 예제에서는 다른 매개 변수 값을 사용 하 여 개체를 만든 UTF32Encoding 다음 같은지 확인 합니다.

using namespace System;
using namespace System::Text;
void CompareEncodings( UTF32Encoding ^ a, String^ name );
int main()
{
   
   // Create different instances of UTF32Encoding.
   UTF32Encoding ^ u32 = gcnew UTF32Encoding;
   UTF32Encoding ^ u32tt = gcnew UTF32Encoding( true,true );
   UTF32Encoding ^ u32tf = gcnew UTF32Encoding( true,false );
   UTF32Encoding ^ u32ft = gcnew UTF32Encoding( false,true );
   UTF32Encoding ^ u32ff = gcnew UTF32Encoding( false,false );
   
   // Compare these instances with instances created using the ctor with three parameters.
   CompareEncodings( u32, "u32  " );
   CompareEncodings( u32tt, "u32tt" );
   CompareEncodings( u32tf, "u32tf" );
   CompareEncodings( u32ft, "u32ft" );
   CompareEncodings( u32ff, "u32ff" );
}

void CompareEncodings( UTF32Encoding ^ a, String^ name )
{
   
   // Create different instances of UTF32Encoding using the ctor with three parameters.
   UTF32Encoding ^ u32ttt = gcnew UTF32Encoding( true,true,true );
   UTF32Encoding ^ u32ttf = gcnew UTF32Encoding( true,true,false );
   UTF32Encoding ^ u32tft = gcnew UTF32Encoding( true,false,true );
   UTF32Encoding ^ u32tff = gcnew UTF32Encoding( true,false,false );
   UTF32Encoding ^ u32ftt = gcnew UTF32Encoding( false,true,true );
   UTF32Encoding ^ u32ftf = gcnew UTF32Encoding( false,true,false );
   UTF32Encoding ^ u32fft = gcnew UTF32Encoding( false,false,true );
   UTF32Encoding ^ u32fff = gcnew UTF32Encoding( false,false,false );
   
   // Compare the specified instance with each of the instances that were just created.
   Console::WriteLine( "{0} and u32ttt : {1}", name, a->Equals( u32ttt ) );
   Console::WriteLine( "{0} and u32ttf : {1}", name, a->Equals( u32ttf ) );
   Console::WriteLine( "{0} and u32tft : {1}", name, a->Equals( u32tft ) );
   Console::WriteLine( "{0} and u32tff : {1}", name, a->Equals( u32tff ) );
   Console::WriteLine( "{0} and u32ftt : {1}", name, a->Equals( u32ftt ) );
   Console::WriteLine( "{0} and u32ftf : {1}", name, a->Equals( u32ftf ) );
   Console::WriteLine( "{0} and u32fft : {1}", name, a->Equals( u32fft ) );
   Console::WriteLine( "{0} and u32fff : {1}", name, a->Equals( u32fff ) );
}

/* 
This code produces the following output.

u32   vs u32ttt : False
u32   vs u32ttf : False
u32   vs u32tft : False
u32   vs u32tff : False
u32   vs u32ftt : False
u32   vs u32ftf : False
u32   vs u32fft : False
u32   vs u32fff : True
u32tt vs u32ttt : False
u32tt vs u32ttf : True
u32tt vs u32tft : False
u32tt vs u32tff : False
u32tt vs u32ftt : False
u32tt vs u32ftf : False
u32tt vs u32fft : False
u32tt vs u32fff : False
u32tf vs u32ttt : False
u32tf vs u32ttf : False
u32tf vs u32tft : False
u32tf vs u32tff : True
u32tf vs u32ftt : False
u32tf vs u32ftf : False
u32tf vs u32fft : False
u32tf vs u32fff : False
u32ft vs u32ttt : False
u32ft vs u32ttf : False
u32ft vs u32tft : False
u32ft vs u32tff : False
u32ft vs u32ftt : False
u32ft vs u32ftf : True
u32ft vs u32fft : False
u32ft vs u32fff : False
u32ff vs u32ttt : False
u32ff vs u32ttf : False
u32ff vs u32tft : False
u32ff vs u32tff : False
u32ff vs u32ftt : False
u32ff vs u32ftf : False
u32ff vs u32fft : False
u32ff vs u32fff : True

*/
using System;
using System.Text;

public class SamplesUTF32Encoding  {

   public static void Main()  {

      // Create different instances of UTF32Encoding.
      UTF32Encoding u32   = new UTF32Encoding();
      UTF32Encoding u32tt = new UTF32Encoding( true, true );
      UTF32Encoding u32tf = new UTF32Encoding( true, false );
      UTF32Encoding u32ft = new UTF32Encoding( false, true );
      UTF32Encoding u32ff = new UTF32Encoding( false, false );

      // Compare these instances with instances created using the ctor with three parameters.
      CompareEncodings( u32,   "u32  " );
      CompareEncodings( u32tt, "u32tt" );
      CompareEncodings( u32tf, "u32tf" );
      CompareEncodings( u32ft, "u32ft" );
      CompareEncodings( u32ff, "u32ff" );
   }

   public static void CompareEncodings( UTF32Encoding a, String name )  {

      // Create different instances of UTF32Encoding using the ctor with three parameters.
      UTF32Encoding u32ttt = new UTF32Encoding( true, true, true );
      UTF32Encoding u32ttf = new UTF32Encoding( true, true, false );
      UTF32Encoding u32tft = new UTF32Encoding( true, false, true );
      UTF32Encoding u32tff = new UTF32Encoding( true, false, false );
      UTF32Encoding u32ftt = new UTF32Encoding( false, true, true );
      UTF32Encoding u32ftf = new UTF32Encoding( false, true, false );
      UTF32Encoding u32fft = new UTF32Encoding( false, false, true );
      UTF32Encoding u32fff = new UTF32Encoding( false, false, false );

      // Compare the specified instance with each of the instances that were just created.
      Console.WriteLine( "{0} and u32ttt : {1}", name, a.Equals( u32ttt ) );
      Console.WriteLine( "{0} and u32ttf : {1}", name, a.Equals( u32ttf ) );
      Console.WriteLine( "{0} and u32tft : {1}", name, a.Equals( u32tft ) );
      Console.WriteLine( "{0} and u32tff : {1}", name, a.Equals( u32tff ) );
      Console.WriteLine( "{0} and u32ftt : {1}", name, a.Equals( u32ftt ) );
      Console.WriteLine( "{0} and u32ftf : {1}", name, a.Equals( u32ftf ) );
      Console.WriteLine( "{0} and u32fft : {1}", name, a.Equals( u32fft ) );
      Console.WriteLine( "{0} and u32fff : {1}", name, a.Equals( u32fff ) );
   }
}


/* 
This code produces the following output.

u32   vs u32ttt : False
u32   vs u32ttf : False
u32   vs u32tft : False
u32   vs u32tff : False
u32   vs u32ftt : False
u32   vs u32ftf : False
u32   vs u32fft : False
u32   vs u32fff : True
u32tt vs u32ttt : False
u32tt vs u32ttf : True
u32tt vs u32tft : False
u32tt vs u32tff : False
u32tt vs u32ftt : False
u32tt vs u32ftf : False
u32tt vs u32fft : False
u32tt vs u32fff : False
u32tf vs u32ttt : False
u32tf vs u32ttf : False
u32tf vs u32tft : False
u32tf vs u32tff : True
u32tf vs u32ftt : False
u32tf vs u32ftf : False
u32tf vs u32fft : False
u32tf vs u32fff : False
u32ft vs u32ttt : False
u32ft vs u32ttf : False
u32ft vs u32tft : False
u32ft vs u32tff : False
u32ft vs u32ftt : False
u32ft vs u32ftf : True
u32ft vs u32fft : False
u32ft vs u32fff : False
u32ff vs u32ttt : False
u32ff vs u32ttf : False
u32ff vs u32tft : False
u32ff vs u32tff : False
u32ff vs u32ftt : False
u32ff vs u32ftf : False
u32ff vs u32fft : False
u32ff vs u32fff : True

*/
Imports System.Text

Public Class SamplesUTF32Encoding   

   Public Shared Sub Main()

      ' Create different instances of UTF32Encoding.
      Dim u32 As New UTF32Encoding()
      Dim u32tt As New UTF32Encoding(True, True)
      Dim u32tf As New UTF32Encoding(True, False)
      Dim u32ft As New UTF32Encoding(False, True)
      Dim u32ff As New UTF32Encoding(False, False)

      ' Compare these instances with instances created using the ctor with three parameters.
      CompareEncodings(u32, "u32  ")
      CompareEncodings(u32tt, "u32tt")
      CompareEncodings(u32tf, "u32tf")
      CompareEncodings(u32ft, "u32ft")
      CompareEncodings(u32ff, "u32ff")

   End Sub


   Public Shared Sub CompareEncodings(a As UTF32Encoding, name As String)

      ' Create different instances of UTF32Encoding using the ctor with three parameters.
      Dim u32ttt As New UTF32Encoding(True, True, True)
      Dim u32ttf As New UTF32Encoding(True, True, False)
      Dim u32tft As New UTF32Encoding(True, False, True)
      Dim u32tff As New UTF32Encoding(True, False, False)
      Dim u32ftt As New UTF32Encoding(False, True, True)
      Dim u32ftf As New UTF32Encoding(False, True, False)
      Dim u32fft As New UTF32Encoding(False, False, True)
      Dim u32fff As New UTF32Encoding(False, False, False)

      ' Compare the specified instance with each of the instances that were just created.
      Console.WriteLine("{0} and u32ttt : {1}", name, a.Equals(u32ttt))
      Console.WriteLine("{0} and u32ttf : {1}", name, a.Equals(u32ttf))
      Console.WriteLine("{0} and u32tft : {1}", name, a.Equals(u32tft))
      Console.WriteLine("{0} and u32tff : {1}", name, a.Equals(u32tff))
      Console.WriteLine("{0} and u32ftt : {1}", name, a.Equals(u32ftt))
      Console.WriteLine("{0} and u32ftf : {1}", name, a.Equals(u32ftf))
      Console.WriteLine("{0} and u32fft : {1}", name, a.Equals(u32fft))
      Console.WriteLine("{0} and u32fff : {1}", name, a.Equals(u32fff))

   End Sub

End Class


'This code produces the following output.
'
'u32   vs u32ttt : False
'u32   vs u32ttf : False
'u32   vs u32tft : False
'u32   vs u32tff : False
'u32   vs u32ftt : False
'u32   vs u32ftf : False
'u32   vs u32fft : False
'u32   vs u32fff : True
'u32tt vs u32ttt : False
'u32tt vs u32ttf : True
'u32tt vs u32tft : False
'u32tt vs u32tff : False
'u32tt vs u32ftt : False
'u32tt vs u32ftf : False
'u32tt vs u32fft : False
'u32tt vs u32fff : False
'u32tf vs u32ttt : False
'u32tf vs u32ttf : False
'u32tf vs u32tft : False
'u32tf vs u32tff : True
'u32tf vs u32ftt : False
'u32tf vs u32ftf : False
'u32tf vs u32fft : False
'u32tf vs u32fff : False
'u32ft vs u32ttt : False
'u32ft vs u32ttf : False
'u32ft vs u32tft : False
'u32ft vs u32tff : False
'u32ft vs u32ftt : False
'u32ft vs u32ftf : True
'u32ft vs u32fft : False
'u32ft vs u32fff : False
'u32ff vs u32ttt : False
'u32ff vs u32ttf : False
'u32ff vs u32tft : False
'u32ff vs u32tff : False
'u32ff vs u32ftt : False
'u32ff vs u32ftf : False
'u32ff vs u32fft : False
'u32ff vs u32fff : True

설명

다음 조건이 모두 true이면 두 UTF32Encoding 개체가 같은 것으로 간주됩니다.

  • 두 개체 모두 동일한 바이트 순서를 사용합니다.

  • 두 개체 모두 바이트 순서 표시를 제공하거나 둘 다 제공하지 않습니다.

  • 두 개체 모두 동일한 인코더 대체를 사용합니다.

  • 두 개체 모두 동일한 디코더 대체를 사용합니다.

적용 대상

추가 정보