Encoding.Equals(Object) 메서드
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
지정된 Object 인스턴스가 현재 인스턴스와 같은지 여부를 확인합니다.
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
매개 변수
반품
true인스턴스이고 현재 인스턴스 value 와 같으면 Encoding .이고, false그렇지 않으면 .
예제
다음 예제에서는 동일한 인코딩의 두 인스턴스(코드 페이지와 이름으로 하나씩)를 가져오고 해당 인스턴스의 같음을 확인합니다.
using System;
using System.Text;
public class SamplesEncoding {
public static void Main() {
// Get a UTF-32 encoding by codepage.
Encoding e1 = Encoding.GetEncoding( 12000 );
// Get a UTF-32 encoding by name.
Encoding e2 = Encoding.GetEncoding( "utf-32" );
// Check their equality.
Console.WriteLine( "e1 equals e2? {0}", e1.Equals( e2 ) );
}
}
/*
This code produces the following output.
e1 equals e2? True
*/
Imports System.Text
Public Class SamplesEncoding
Public Shared Sub Main()
' Get a UTF-32 encoding by codepage.
Dim e1 As Encoding = Encoding.GetEncoding(12000)
' Get a UTF-32 encoding by name.
Dim e2 As Encoding = Encoding.GetEncoding("utf-32")
' Check their equality.
Console.WriteLine("e1 equals e2? {0}", e1.Equals(e2))
End Sub
End Class
'This code produces the following output.
'
'e1 equals e2? True
설명
두 인스턴스는 Encoding 동일한 코드 페이지에 해당하고 해당 인스턴스와 EncoderFallbackDecoderFallback 개체가 같으면 같은 것으로 간주됩니다. 특히 파생된 코드 페이지에는 모두 0의 코드 페이지가 있으며 해당 대체는 일반적으로 null(Visual Basic .NET Nothing)입니다. 따라서 그들은 모두 서로 동등한 것으로 간주됩니다. 한 가지 결과는 해시 테이블을 채우는 데 사용될 때 Equals 파생된 모든 인코딩이 같음과 동일한 해시 테이블 슬롯에 속한다는 것입니다.