Encoding.Equals Method (Object)
.NET Framework 2.0
Determines whether the specified Object is equal to the current instance.
Namespace: System.Text
Assembly: mscorlib (in mscorlib.dll)
Assembly: mscorlib (in mscorlib.dll)
The following code example gets two instances of the same encoding (one by codepage and another by name), and checks their equality.
using namespace System; using namespace System::Text; int main() { // Get a UTF-32 encoding by codepage. Encoding^ e1 = Encoding::GetEncoding( 65005 ); // 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 */
import System.*;
import System.Text.*;
public class SamplesEncoding
{
public static void main(String[] args)
{
// Get a UTF-32 encoding by codepage.
Encoding e1 = Encoding.GetEncoding(65005);
// Get a UTF-32 encoding by name.
Encoding e2 = Encoding.GetEncoding("utf-32");
// Check their equality.
Console.WriteLine("e1 equals e2? {0}",
System.Convert.ToString(e1.Equals(e2)));
} //main
} //SamplesEncoding
/*
This code produces the following output.
e1 equals e2? True
*/
Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.
Community Additions
ADD
Show: