Struct EncodingContext
Represents text encoding context.
Namespace: DotNext.Text
Assembly: DotNext.dll
Syntax
public struct EncodingContext
Remarks
The context represents an encoding cache to avoid memory allocations for each round of string encoding caused by methods of StreamExtensions class.
Constructors
| Improve this Doc View SourceEncodingContext(Encoding, Boolean)
Initializes a new encoding context.
Declaration
public EncodingContext(Encoding encoding, bool reuseEncoder = false)
Parameters
| Type | Name | Description |
|---|---|---|
| Encoding | encoding | The encoding to be used for converting string into bytes. |
| Boolean | reuseEncoder | true to reuse the encoder between encoding operations; false to create separated encoder for each encoding operation. |
Properties
| Improve this Doc View SourceEncoding
Gets encoding associated with this context.
Declaration
public Encoding Encoding { get; }
Property Value
| Type | Description |
|---|---|
| Encoding |
Methods
| Improve this Doc View SourceReset()
Sets the encapsulated encoder to its initial state.
Declaration
public void Reset()
Operators
| Improve this Doc View SourceImplicit(Encoding to EncodingContext)
Creates encoding context
Declaration
public static implicit operator EncodingContext(Encoding encoding)
Parameters
| Type | Name | Description |
|---|---|---|
| Encoding | encoding | The text encoding. |
Returns
| Type | Description |
|---|---|
| EncodingContext |