Show / Hide Table of Contents

Struct EncodingContext

Represents text encoding context.

Implements
ICloneable
Inherited Members
ValueType.Equals(Object)
ValueType.GetHashCode()
ValueType.ToString()
Object.Equals(Object, Object)
Object.GetType()
Object.ReferenceEquals(Object, Object)
Namespace: DotNext.Text
Assembly: DotNext.IO.dll
Syntax
public struct EncodingContext : ICloneable
Remarks

The context represents an encoding cache to avoid memory allocations for each round of string encoding caused by methods of StreamExtensions class. It cannot be shared across parallel flows or threads. However, you can call Copy() method to create an independent copy of this context for separated async flow or thread.

Constructors

| Improve this Doc View Source

EncodingContext(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.

Exceptions
Type Condition
ArgumentNullException

encoding is null.

Properties

| Improve this Doc View Source

Encoding

Gets encoding associated with this context.

Declaration
public Encoding Encoding { get; }
Property Value
Type Description
Encoding

Methods

| Improve this Doc View Source

Copy()

Creates independent copy of this context that can be used in separated async flow or thread.

Declaration
public EncodingContext Copy()
Returns
Type Description
EncodingContext

The independent copy of this context.

| Improve this Doc View Source

Reset()

Sets the encapsulated encoder to its initial state.

Declaration
public void Reset()

Operators

| Improve this Doc View Source

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

Explicit Interface Implementations

| Improve this Doc View Source

ICloneable.Clone()

Declaration
object ICloneable.Clone()
Returns
Type Description
Object

Implements

System.ICloneable

Extension Methods

Sequence.Skip<TEnumerator, T>(ref TEnumerator, Int32)
ExpressionBuilder.Const<T>(T)
  • Improve this Doc
  • View Source
In This Article
Back to top Generated by DocFX