Encoding Encoding Encoding Encoding Constructors

Definition

Overloads

Encoding() Encoding() Encoding()

Initializes a new instance of the Encoding class.

Encoding(Int32) Encoding(Int32) Encoding(Int32) Encoding(Int32)

Initializes a new instance of the Encoding class that corresponds to the specified code page.

Encoding(Int32, EncoderFallback, DecoderFallback) Encoding(Int32, EncoderFallback, DecoderFallback) Encoding(Int32, EncoderFallback, DecoderFallback)

Initializes a new instance of the Encoding class that corresponds to the specified code page with the specified encoder and decoder fallback strategies.

Encoding() Encoding() Encoding()

Initializes a new instance of the Encoding class.

protected:
 Encoding();
protected Encoding ();
Protected Sub New ()

Remarks

Derived classes override this constructor.

See also

Encoding(Int32) Encoding(Int32) Encoding(Int32) Encoding(Int32)

Initializes a new instance of the Encoding class that corresponds to the specified code page.

protected:
 Encoding(int codePage);
protected Encoding (int codePage);
new System.Text.Encoding : int -> System.Text.Encoding
Protected Sub New (codePage As Integer)

Parameters

codePage
Int32 Int32 Int32 Int32

The code page identifier of the preferred encoding.

-or-

0, to use the default encoding.

Exceptions

Remarks

Derived classes override this constructor.

Calls to this constructor from a derived class create an Encoding object that uses best-fit fallback for both encoding and decoding operations. Both the DecoderFallback and EncoderFallback properties are read-only and cannot be modified. To control the fallback strategy for a class derived from Encoding, call the Encoding(Int32, EncoderFallback, DecoderFallback) constructor.

See also

Encoding(Int32, EncoderFallback, DecoderFallback) Encoding(Int32, EncoderFallback, DecoderFallback) Encoding(Int32, EncoderFallback, DecoderFallback)

Initializes a new instance of the Encoding class that corresponds to the specified code page with the specified encoder and decoder fallback strategies.

protected:
 Encoding(int codePage, System::Text::EncoderFallback ^ encoderFallback, System::Text::DecoderFallback ^ decoderFallback);
protected Encoding (int codePage, System.Text.EncoderFallback encoderFallback, System.Text.DecoderFallback decoderFallback);
new System.Text.Encoding : int * System.Text.EncoderFallback * System.Text.DecoderFallback -> System.Text.Encoding

Parameters

codePage
Int32 Int32 Int32 Int32

The encoding code page identifier.

encoderFallback
EncoderFallback EncoderFallback EncoderFallback EncoderFallback

An object that provides an error-handling procedure when a character cannot be encoded with the current encoding.

decoderFallback
DecoderFallback DecoderFallback DecoderFallback DecoderFallback

An object that provides an error-handling procedure when a byte sequence cannot be decoded with the current encoding.

Exceptions

Remarks

This constructor is protected; derived classes override it.

You call this constructor from a derived class to control the fallback encoding and decoding strategies. The Encoding class constructors create read-only encoding objects that don't allow encoder or decoder fallback to be set after the object is created.

If either encoderFallback or decoderFallback is null, best-fit fallback is used as the corresponding fallback strategy.

Applies to