EncodingProvider::GetEncoding Method (String^)

.NET Framework (current version)
 

Returns the encoding with the specified name.

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

public:
virtual Encoding^ GetEncoding(
	String^ name
) abstract

Parameters

name
Type: System::String^

The name of the requested encoding.

Return Value

Type: System.Text::Encoding^

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

Notes to Callers:

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

Notes to Inheritors:

You override the GetEncoding(String^) 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 method, the method passes the name argument to every registered encoding provider until one returns a valid encoding. If none returns a valid encoding, the Encoding::GetEncoding(String^) method attempts to retrieve a cached encoding whose name is name. Because of this, if name is not the name of an encoding that you support, the method should return null. The only case in which the method should throw an exception is if name is null.

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