EncodingProvider::GetEncoding Method (Int32)

.NET Framework (current version)
 

Returns the encoding associated with the specified code page identifier.

Namespace:   System.Text
Assembly:  mscorlib (in mscorlib.dll)

public:
virtual Encoding^ GetEncoding(
	int codepage
) abstract

Parameters

codepage
Type: System::Int32

The code page identifier of the requested encoding.

Return Value

Type: System.Text::Encoding^

The encoding that is associated with the specified code page, or null if this EncodingProvider cannot return a valid encoding that corresponds to codepage.

Notes to Callers:

This method is called by the Encoding::GetEncoding(Int32) method. You should not call it directly from user code.

Notes to Inheritors:

You override the GetEncoding(Int32) method to return the encoding or encodings supported by your EncodingProvider subclass. When user code attempts to retrieve an encoding by calling the Encoding::GetEncoding(Int32) method, the method passes the codepage identifier to every registered encoding provider until one returns a valid encoding. If none returns a valid encoding, the Encoding::GetEncoding method attempts to retrieve a cached encoding whose code page identifier is codepage. Because of this, if codepage is not the code page identifier of an encoding that you support, the method should return null; it should never throw an exception.

Universal Windows Platform
Available since 10
.NET Framework
Available since 4.6
Return to top
Show: