Επεξεργασία

Κοινή χρήση μέσω


Encoding Constructors

Definition

Initializes a new instance of the Encoding class.

Overloads

Encoding()

Initializes a new instance of the Encoding class.

Encoding(Int32)

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

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()

Source:
Encoding.cs
Source:
Encoding.cs
Source:
Encoding.cs

Initializes a new instance of the Encoding class.

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

Remarks

Derived classes override this constructor.

See also

Applies to

Encoding(Int32)

Source:
Encoding.cs
Source:
Encoding.cs
Source:
Encoding.cs

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

The code page identifier of the preferred encoding.

-or-

0, to use the default encoding.

Exceptions

codePage is less than zero.

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

Applies to

Encoding(Int32, EncoderFallback, DecoderFallback)

Source:
Encoding.cs
Source:
Encoding.cs
Source:
Encoding.cs

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);
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
Protected Sub New (codePage As Integer, encoderFallback As EncoderFallback, decoderFallback As DecoderFallback)

Parameters

codePage
Int32

The encoding code page identifier.

encoderFallback
EncoderFallback

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

decoderFallback
DecoderFallback

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

Exceptions

codePage is less than zero.

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