Encoding Constructors
Definition
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()
Initializes a new instance of the Encoding class.
protected Encoding ();
Remarks
Derived classes override this constructor.
Encoding(Int32)
Initializes a new instance of the Encoding class that corresponds to the specified code page.
protected Encoding (int codePage);
- codePage
- Int32
The code page identifier of the preferred encoding.
-or-
0, to use the default encoding.
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.
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);
- 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.
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.