Show / Hide Table of Contents

Class EncodingExtensions

Represents extension method for Encoding data type.

Inheritance
object
EncodingExtensions
Inherited Members
object.GetType()
object.MemberwiseClone()
object.ToString()
object.Equals(object)
object.Equals(object, object)
object.ReferenceEquals(object, object)
object.GetHashCode()
Namespace: DotNext.Text
Assembly: DotNext.dll
Syntax
public static class EncodingExtensions

Methods

View Source

GetBytes(Encoding, ReadOnlySpan<char>, MemoryAllocator<byte>?)

Encodes a set of characters from the specified read-only span.

Declaration
public static MemoryOwner<byte> GetBytes(this Encoding encoding, ReadOnlySpan<char> chars, MemoryAllocator<byte>? allocator = null)
Parameters
Type Name Description
Encoding encoding
ReadOnlySpan<char> chars

The characters to encode.

MemoryAllocator<byte> allocator

The memory allocator.

Returns
Type Description
MemoryOwner<byte>

The memory containing encoded characters.

View Source

GetChars(Encoding, ReadOnlySpan<byte>, MemoryAllocator<char>?)

Decodes all the bytes in the specified read-only span.

Declaration
public static MemoryOwner<char> GetChars(this Encoding encoding, ReadOnlySpan<byte> bytes, MemoryAllocator<char>? allocator = null)
Parameters
Type Name Description
Encoding encoding
ReadOnlySpan<byte> bytes

The set of bytes representing encoded characters.

MemoryAllocator<char> allocator

The memory allocator.

Returns
Type Description
MemoryOwner<char>

The memory containing decoded characters.

View Source

get_UTF8NoBom()

Gets UTF8 encoding that doesn't emit byte order mark.

Declaration
public static UTF8Encoding get_UTF8NoBom()
Returns
Type Description
UTF8Encoding
View Source

get_WithoutPreamble(Encoding)

Returns Encoding that doesn't generate BOM.

Declaration
public static Encoding get_WithoutPreamble(Encoding encoding)
Parameters
Type Name Description
Encoding encoding
Returns
Type Description
Encoding

The source encoding without BOM.

  • View Source
☀
☾
In this article
Back to top
Supported by the .NET Foundation
☀
☾