次の方法で共有


UTF8Encoding クラス

定義

Unicode 文字の UTF-8 エンコードを表します。

public ref class UTF8Encoding : System::Text::Encoding
public class UTF8Encoding : System.Text.Encoding
[System.Serializable]
public class UTF8Encoding : System.Text.Encoding
[System.Serializable]
[System.Runtime.InteropServices.ComVisible(true)]
public class UTF8Encoding : System.Text.Encoding
type UTF8Encoding = class
    inherit Encoding
[<System.Serializable>]
type UTF8Encoding = class
    inherit Encoding
[<System.Serializable>]
[<System.Runtime.InteropServices.ComVisible(true)>]
type UTF8Encoding = class
    inherit Encoding
Public Class UTF8Encoding
Inherits Encoding
継承
UTF8Encoding
属性

次の例では、 UTF8Encoding オブジェクトを使用して Unicode 文字の文字列をエンコードし、バイト配列に格納します。 Unicode 文字列には、ASCII 文字範囲外の 2 文字の Pi (U+03A0) と Sigma (U+03A3) が含まれます。 エンコードされたバイト配列が文字列にデコードされると、Pi 文字と Sigma 文字は引き続き存在します。

using System;
using System.Text;

class Example
{
    public static void Main()
    {
        // Create a UTF-8 encoding.
        UTF8Encoding utf8 = new UTF8Encoding();
        
        // A Unicode string with two characters outside an 8-bit code range.
        String unicodeString =
            "This Unicode string has 2 characters outside the " +
            "ASCII range:\n" +
            "Pi (\u03a0), and Sigma (\u03a3).";
        Console.WriteLine("Original string:");
        Console.WriteLine(unicodeString);

        // Encode the string.
        Byte[] encodedBytes = utf8.GetBytes(unicodeString);
        Console.WriteLine();
        Console.WriteLine("Encoded bytes:");
        for (int ctr = 0; ctr < encodedBytes.Length; ctr++) {
            Console.Write("{0:X2} ", encodedBytes[ctr]);
            if ((ctr + 1) %  25 == 0)
               Console.WriteLine();
        }
        Console.WriteLine();
        
        // Decode bytes back to string.
        String decodedString = utf8.GetString(encodedBytes);
        Console.WriteLine();
        Console.WriteLine("Decoded bytes:");
        Console.WriteLine(decodedString);
    }
}
// The example displays the following output:
//    Original string:
//    This Unicode string has 2 characters outside the ASCII range:
//    Pi (π), and Sigma (Σ).
//
//    Encoded bytes:
//    54 68 69 73 20 55 6E 69 63 6F 64 65 20 73 74 72 69 6E 67 20 68 61 73 20 32
//    20 63 68 61 72 61 63 74 65 72 73 20 6F 75 74 73 69 64 65 20 74 68 65 20 41
//    53 43 49 49 20 72 61 6E 67 65 3A 20 0D 0A 50 69 20 28 CE A0 29 2C 20 61 6E
//    64 20 53 69 67 6D 61 20 28 CE A3 29 2E
//
//    Decoded bytes:
//    This Unicode string has 2 characters outside the ASCII range:
//    Pi (π), and Sigma (Σ).
Imports System.Text

Class Example
    Public Shared Sub Main()
        ' Create a UTF-8 encoding.
        Dim utf8 As New UTF8Encoding()
        
        ' A Unicode string with two characters outside an 8-bit code range.
        Dim unicodeString As String = _
            "This Unicode string has 2 characters outside the " &
            "ASCII range: " & vbCrLf &
            "Pi (" & ChrW(&h03A0) & "), and Sigma (" & ChrW(&h03A3) & ")."
        Console.WriteLine("Original string:")
        Console.WriteLine(unicodeString)
        
        ' Encode the string.
        Dim encodedBytes As Byte() = utf8.GetBytes(unicodeString)
        Console.WriteLine()
        Console.WriteLine("Encoded bytes:")
        For ctr As Integer = 0 To encodedBytes.Length - 1
            Console.Write("{0:X2} ", encodedBytes(ctr))
            If (ctr + 1) Mod 25 = 0 Then Console.WriteLine
        Next
        Console.WriteLine()
        
        ' Decode bytes back to string.
        Dim decodedString As String = utf8.GetString(encodedBytes)
        Console.WriteLine()
        Console.WriteLine("Decoded bytes:")
        Console.WriteLine(decodedString)
    End Sub
End Class
' The example displays the following output:
'    Original string:
'    This Unicode string has 2 characters outside the ASCII range:
'    Pi (π), and Sigma (Σ).
'
'    Encoded bytes:
'    54 68 69 73 20 55 6E 69 63 6F 64 65 20 73 74 72 69 6E 67 20 68 61 73 20 32
'    20 63 68 61 72 61 63 74 65 72 73 20 6F 75 74 73 69 64 65 20 74 68 65 20 41
'    53 43 49 49 20 72 61 6E 67 65 3A 20 0D 0A 50 69 20 28 CE A0 29 2C 20 61 6E
'    64 20 53 69 67 6D 61 20 28 CE A3 29 2E
'
'    Decoded bytes:
'    This Unicode string has 2 characters outside the ASCII range:
'    Pi (π), and Sigma (Σ).

次の例では、エンコードされたバイトをファイルに書き込み、バイト ストリームにバイト オーダー マーク (BOM) のプレフィックスを付ける点を除き、前の例と同じ文字列を使用します。 次に、 StreamReader オブジェクトを使用してテキスト ファイルとして、バイナリ ファイルとして、2 つの異なる方法でファイルを読み取ります。 ご期待のとおり、新しく読み取られた文字列には BOM は含まれておりいません。

using System;
using System.IO;
using System.Text;

public class Example
{
   public static void Main()
   {
        // Create a UTF-8 encoding that supports a BOM.
        Encoding utf8 = new UTF8Encoding(true);

        // A Unicode string with two characters outside an 8-bit code range.
        String unicodeString =
            "This Unicode string has 2 characters outside the " +
            "ASCII range:\n" +
            "Pi (\u03A0)), and Sigma (\u03A3).";
        Console.WriteLine("Original string:");
        Console.WriteLine(unicodeString);
        Console.WriteLine();

        // Encode the string.
        Byte[] encodedBytes = utf8.GetBytes(unicodeString);
        Console.WriteLine("The encoded string has {0} bytes.",
                          encodedBytes.Length);
        Console.WriteLine();

        // Write the bytes to a file with a BOM.
        var fs = new FileStream(@".\UTF8Encoding.txt", FileMode.Create);
        Byte[] bom = utf8.GetPreamble();
        fs.Write(bom, 0, bom.Length);
        fs.Write(encodedBytes, 0, encodedBytes.Length);
        Console.WriteLine("Wrote {0} bytes to the file.", fs.Length);
        fs.Close();
        Console.WriteLine();

        // Open the file using StreamReader.
        var sr = new StreamReader(@".\UTF8Encoding.txt");
        String newString = sr.ReadToEnd();
        sr.Close();
        Console.WriteLine("String read using StreamReader:");
        Console.WriteLine(newString);
        Console.WriteLine();

        // Open the file as a binary file and decode the bytes back to a string.
        fs = new FileStream(@".\UTF8Encoding.txt", FileMode.Open);
        Byte[] bytes = new Byte[fs.Length];
        fs.Read(bytes, 0, (int)fs.Length);
        fs.Close();

        String decodedString = utf8.GetString(bytes);
        Console.WriteLine("Decoded bytes:");
        Console.WriteLine(decodedString);
   }
}
// The example displays the following output:
//    Original string:
//    This Unicode string has 2 characters outside the ASCII range:
//    Pi (π), and Sigma (Σ).
//
//    The encoded string has 88 bytes.
//
//    Wrote 91 bytes to the file.
//
//    String read using StreamReader:
//    This Unicode string has 2 characters outside the ASCII range:
//    Pi (π), and Sigma (Σ).
//
//    Decoded bytes:
//    This Unicode string has 2 characters outside the ASCII range:
//    Pi (π), and Sigma (Σ).
Imports System.IO
Imports System.Text

Class Example
    Public Shared Sub Main()
        ' Create a UTF-8 encoding that supports a BOM.
        Dim utf8 As New UTF8Encoding(True)
        
        ' A Unicode string with two characters outside an 8-bit code range.
        Dim unicodeString As String = _
            "This Unicode string has 2 characters outside the " &
            "ASCII range: " & vbCrLf &
            "Pi (" & ChrW(&h03A0) & "), and Sigma (" & ChrW(&h03A3) & ")."
        Console.WriteLine("Original string:")
        Console.WriteLine(unicodeString)
        Console.WriteLine()
        
        ' Encode the string.
        Dim encodedBytes As Byte() = utf8.GetBytes(unicodeString)
        Console.WriteLine("The encoded string has {0} bytes.",
                          encodedBytes.Length)
        Console.WriteLine()
        
        ' Write the bytes to a file with a BOM.
        Dim fs As New FileStream(".\UTF8Encoding.txt", FileMode.Create)
        Dim bom() As Byte = utf8.GetPreamble()
        fs.Write(bom, 0, bom.Length)
        fs.Write(encodedBytes, 0, encodedBytes.Length)
        Console.WriteLine("Wrote {0} bytes to the file.", fs.Length)
        fs.Close()
        Console.WriteLine()
        
        ' Open the file using StreamReader.
        Dim sr As New StreamReader(".\UTF8Encoding.txt")
        Dim newString As String = sr.ReadToEnd()
        sr.Close()
        Console.WriteLine("String read using StreamReader:")
        Console.WriteLine(newString)
        Console.WriteLine()
        
        ' Open the file as a binary file and decode the bytes back to a string.
        fs = new FileStream(".\UTF8Encoding.txt", FileMode.Open)
        Dim bytes(fs.Length - 1) As Byte
        fs.Read(bytes, 0, fs.Length)
        fs.Close()

        Dim decodedString As String = utf8.GetString(bytes)
        Console.WriteLine("Decoded bytes:")
        Console.WriteLine(decodedString)
    End Sub
End Class
' The example displays the following output:
'    Original string:
'    This Unicode string has 2 characters outside the ASCII range:
'    Pi (π), and Sigma (Σ).
'
'    The encoded string has 88 bytes.
'
'    Wrote 91 bytes to the file.
'
'    String read using StreamReader:
'    This Unicode string has 2 characters outside the ASCII range:
'    Pi (π), and Sigma (Σ).
'
'    Decoded bytes:
'    This Unicode string has 2 characters outside the ASCII range:
'    Pi (π), and Sigma (Σ).

注釈

エンコードは、一連の Unicode 文字をバイト シーケンスに変換するプロセスです。 デコードは、エンコードされたバイトのシーケンスを一連の Unicode 文字に変換するプロセスです。

UTF-8 は、各コード ポイントを 1 ~ 4 バイトのシーケンスとして表す Unicode エンコードです。 UTF-16 および UTF-32 エンコードとは異なり、UTF-8 エンコードでは "エンディアン" は必要ありません。エンコード 方式は、プロセッサがビッグ エンディアンかリトル エンディアンかに関係なく同じです。 UTF8Encoding は、Windows コード ページ 65001 に対応します。 System.Textでサポートされる UDF とその他のエンコードの詳細については、「.NET Framework での文字エンコード」を参照してください。

バイト オーダー マーク (BOM) を提供するかどうか、およびエラー検出を有効にするかどうかに応じて、さまざまな方法で UTF8Encoding オブジェクトをインスタンス化できます。 次の表に、UTF8Encoding オブジェクトを返すコンストラクターとEncoding プロパティを示します。

メンバー BOM エラー検出
Encoding.UTF8 はい いいえ (代替フォールバック)
UTF8Encoding.UTF8Encoding() いいえ いいえ (代替フォールバック)
UTF8Encoding.UTF8Encoding(Boolean) Configurable いいえ (代替フォールバック)
UTF8Encoding.UTF8Encoding(Boolean, Boolean) Configurable Configurable

GetByteCountメソッドは、Unicode 文字のセットをエンコードする結果のバイト数を決定し、GetBytes メソッドは実際のエンコードを実行します。

同様に、 GetCharCount メソッドはバイト シーケンスをデコードする結果の文字数を決定し、 GetChars メソッドと GetString メソッドは実際のデコードを実行します。

複数のブロックにまたがるデータ (100,000 文字のセグメントでエンコードされた 100 万文字の文字列など) をエンコードまたはデコードするときに状態情報を保存できるエンコーダーまたはデコーダーの場合は、それぞれ GetEncoder プロパティと GetDecoder プロパティを使用します。

必要に応じて、 UTF8Encoding オブジェクトはバイト オーダー マーク (BOM) を提供します。これはバイト配列であり、エンコード プロセスの結果としてバイト ストリームの先頭にプレフィックスを付けることができます。 UTF-8 でエンコードされたバイト ストリームの先頭にバイト オーダー マーク (BOM) が付いている場合、デコーダーがバイトオーダーと変換形式または UTF を判断するのに役立ちます。 ただし、Unicode 標準では UTF-8 でエンコードされたストリームで BOM を必要とせず、推奨もしません。 バイト順とバイト順マークの詳細については、 Unicode ホーム ページの Unicode 標準を参照してください。

エンコーダーが BOM を提供するように構成されている場合は、 GetPreamble メソッドを呼び出して取得できます。それ以外の場合、メソッドは空の配列を返します。 UTF8Encoding オブジェクトが BOM サポート用に構成されている場合でも、必要に応じてエンコードされたバイト ストリームの先頭に BOM を含める必要があります。UTF8Encoding クラスのエンコード メソッドでは、この処理は自動的には行われません。

注意事項

エラー検出を有効にし、クラス インスタンスのセキュリティを強化するには、 UTF8Encoding(Boolean, Boolean) コンストラクターを呼び出し、 throwOnInvalidBytes パラメーターを true に設定する必要があります。 エラー検出を有効にすると、無効な一連の文字またはバイトを検出するメソッドは、 ArgumentException 例外をスローします。 エラー検出がないと、例外はスローされず、無効なシーケンスは通常無視されます。

Note

オブジェクトが異なる .NET Framework バージョンを使用してシリアル化および逆シリアル化されている場合、UTF-8 でエンコードされたオブジェクトの状態は保持されません。

コンストラクター

名前 説明
UTF8Encoding()

UTF8Encoding クラスの新しいインスタンスを初期化します。

UTF8Encoding(Boolean, Boolean)

UTF8Encoding クラスの新しいインスタンスを初期化します。 パラメーターは、Unicode バイトオーダー マークを指定するかどうか、および無効なエンコードが検出されたときに例外をスローするかどうかを指定します。

UTF8Encoding(Boolean)

UTF8Encoding クラスの新しいインスタンスを初期化します。 パラメーターは、Unicode バイトオーダー マークを指定するかどうかを指定します。

プロパティ

名前 説明
BodyName

派生クラスでオーバーライドされると、メール エージェントの本文タグで使用できる現在のエンコードの名前を取得します。

(継承元 Encoding)
CodePage

派生クラスでオーバーライドされると、現在の Encodingのコード ページ識別子を取得します。

(継承元 Encoding)
DecoderFallback

現在のDecoderFallback オブジェクトのEncoding オブジェクトを取得または設定します。

(継承元 Encoding)
EncoderFallback

現在のEncoderFallback オブジェクトのEncoding オブジェクトを取得または設定します。

(継承元 Encoding)
EncodingName

派生クラスでオーバーライドされると、現在のエンコードの人間が判読できる説明を取得します。

(継承元 Encoding)
HeaderName

派生クラスでオーバーライドされると、メール エージェントのヘッダー タグで使用できる現在のエンコードの名前を取得します。

(継承元 Encoding)
IsBrowserDisplay

派生クラスでオーバーライドされると、現在のエンコードをブラウザー クライアントがコンテンツの表示に使用できるかどうかを示す値を取得します。

(継承元 Encoding)
IsBrowserSave

派生クラスでオーバーライドされた場合、コンテンツを保存するためにブラウザー クライアントが現在のエンコードを使用できるかどうかを示す値を取得します。

(継承元 Encoding)
IsMailNewsDisplay

派生クラスでオーバーライドされた場合、現在のエンコードをメールおよびニュース クライアントがコンテンツを表示するために使用できるかどうかを示す値を取得します。

(継承元 Encoding)
IsMailNewsSave

派生クラスでオーバーライドされると、現在のエンコードをメールおよびニュース クライアントがコンテンツの保存に使用できるかどうかを示す値を取得します。

(継承元 Encoding)
IsReadOnly

派生クラスでオーバーライドされると、現在のエンコードが読み取り専用かどうかを示す値を取得します。

(継承元 Encoding)
IsSingleByte

派生クラスでオーバーライドされた場合、現在のエンコードで 1 バイト コード ポイントを使用するかどうかを示す値を取得します。

(継承元 Encoding)
Preamble

UTF-8 形式でエンコードされた Unicode バイトオーダー マークを取得します (このオブジェクトが UTF-8 形式を指定するように構成されている場合)。

Preamble

派生クラスでオーバーライドされると、使用されるエンコードを指定するバイトシーケンスを含むスパンを返します。

(継承元 Encoding)
WebName

派生クラスでオーバーライドされると、現在のエンコードのインターネット割り当て番号機関 (IANA) に登録されている名前を取得します。

(継承元 Encoding)
WindowsCodePage

派生クラスでオーバーライドされると、現在のエンコードに最も近い Windows オペレーティング システム コード ページを取得します。

(継承元 Encoding)

メソッド

名前 説明
Clone()

派生クラスでオーバーライドされた場合は、現在の Encoding オブジェクトの簡易コピーを作成します。

(継承元 Encoding)
Equals(Object)

指定したオブジェクトが現在の UTF8Encoding オブジェクトと等しいかどうかを判断します。

GetByteCount(Char[], Int32, Int32)

指定した文字配列から文字セットをエンコードすることによって生成されるバイト数を計算します。

GetByteCount(Char[])

派生クラスでオーバーライドされた場合、指定した文字配列内のすべての文字をエンコードすることによって生成されるバイト数を計算します。

(継承元 Encoding)
GetByteCount(Char*, Int32)

指定した文字ポインターから始まる一連の文字をエンコードすることによって生成されるバイト数を計算します。

GetByteCount(ReadOnlySpan<Char>)

指定した文字スパンをエンコードすることによって生成されるバイト数を計算します。

GetByteCount(ReadOnlySpan<Char>)

派生クラスでオーバーライドされた場合、指定した文字スパンの文字をエンコードすることによって生成されるバイト数を計算します。

(継承元 Encoding)
GetByteCount(String, Int32, Int32)

派生クラスでオーバーライドされると、指定した文字列から文字のセットをエンコードすることによって生成されるバイト数を計算します。

(継承元 Encoding)
GetByteCount(String)

指定した String内の文字をエンコードすることによって生成されるバイト数を計算します。

GetBytes(Char[], Int32, Int32, Byte[], Int32)

指定した文字配列の文字セットを、指定したバイト配列にエンコードします。

GetBytes(Char[], Int32, Int32)

派生クラスでオーバーライドされると、指定した文字配列の文字セットをバイトシーケンスにエンコードします。

(継承元 Encoding)
GetBytes(Char[])

派生クラスでオーバーライドされると、指定した文字配列内のすべての文字をバイト シーケンスにエンコードします。

(継承元 Encoding)
GetBytes(Char*, Int32, Byte*, Int32)

指定した文字ポインターから始まる一連の文字を、指定したバイト ポインターから始めて格納されるバイトシーケンスにエンコードします。

GetBytes(ReadOnlySpan<Char>, Span<Byte>)

指定した文字スパンを指定したバイト スパンにエンコードします。

GetBytes(ReadOnlySpan<Char>, Span<Byte>)

派生クラスでオーバーライドされると、指定した読み取り専用スパンの文字セットをバイトスパンにエンコードします。

(継承元 Encoding)
GetBytes(String, Int32, Int32, Byte[], Int32)

指定した String の文字セットを、指定したバイト配列にエンコードします。

GetBytes(String, Int32, Int32)

派生クラスでオーバーライドされると、指定したcountから始まる、指定した文字列内のindexで指定された文字数をバイト配列にエンコードします。

(継承元 Encoding)
GetBytes(String)

指定した String オブジェクト内の文字をバイト シーケンスにエンコードします。

GetBytes(String)

派生クラスでオーバーライドされると、指定した文字列内のすべての文字をバイト シーケンスにエンコードします。

(継承元 Encoding)
GetCharCount(Byte[], Int32, Int32)

指定したバイト配列からバイト シーケンスをデコードすることによって生成される文字数を計算します。

GetCharCount(Byte[])

派生クラスでオーバーライドされると、指定したバイト配列内のすべてのバイトをデコードすることによって生成される文字数を計算します。

(継承元 Encoding)
GetCharCount(Byte*, Int32)

指定したバイト ポインターから始まるバイト シーケンスをデコードすることによって生成される文字数を計算します。

GetCharCount(ReadOnlySpan<Byte>)

指定したバイト スパンをデコードすることによって生成される文字数を計算します。

GetCharCount(ReadOnlySpan<Byte>)

派生クラスでオーバーライドされると、指定された読み取り専用バイト スパンをデコードすることによって生成される文字数を計算します。

(継承元 Encoding)
GetChars(Byte[], Int32, Int32, Char[], Int32)

指定したバイト配列から指定した文字配列にバイト シーケンスをデコードします。

GetChars(Byte[], Int32, Int32)

派生クラスでオーバーライドされると、指定したバイト配列のバイト シーケンスを一連の文字にデコードします。

(継承元 Encoding)
GetChars(Byte[])

派生クラスでオーバーライドされると、指定したバイト配列内のすべてのバイトを一連の文字にデコードします。

(継承元 Encoding)
GetChars(Byte*, Int32, Char*, Int32)

指定したバイト ポインターから始まるバイト シーケンスを、指定した文字ポインターから始めて格納される文字のセットにデコードします。

GetChars(ReadOnlySpan<Byte>, Span<Char>)

指定したバイト スパンを指定した文字スパンにデコードします。

GetChars(ReadOnlySpan<Byte>, Span<Char>)

派生クラスでオーバーライドされると、指定した読み取り専用バイト スパン内のすべてのバイトを文字スパンにデコードします。

(継承元 Encoding)
GetDecoder()

UTF-8 でエンコードされたバイト シーケンスを Unicode 文字のシーケンスに変換するデコーダーを取得します。

GetEncoder()

Unicode 文字のシーケンスを UTF-8 でエンコードされたバイト シーケンスに変換するエンコーダーを取得します。

GetHashCode()

現在のインスタンスのハッシュ コードを返します。

GetMaxByteCount(Int32)

指定した文字数をエンコードすることによって生成される最大バイト数を計算します。

GetMaxCharCount(Int32)

指定したバイト数をデコードすることによって生成される最大文字数を計算します。

GetPreamble()

UTF8Encoding エンコード オブジェクトが UTF-8 形式でエンコードされた Unicode バイトオーダー マークを返します。

GetString(Byte[], Int32, Int32)

バイト配列から文字列にバイト範囲をデコードします。

GetString(Byte[], Int32, Int32)

派生クラスでオーバーライドされると、指定したバイト配列のバイト シーケンスを文字列にデコードします。

(継承元 Encoding)
GetString(Byte[])

派生クラスでオーバーライドされると、指定したバイト配列内のすべてのバイトを文字列にデコードします。

(継承元 Encoding)
GetString(Byte*, Int32)

派生クラスでオーバーライドされると、指定したアドレスから始まる指定したバイト数を文字列にデコードします。

(継承元 Encoding)
GetString(ReadOnlySpan<Byte>)

派生クラスでオーバーライドされると、指定したバイト スパン内のすべてのバイトを文字列にデコードします。

(継承元 Encoding)
GetType()

現在のインスタンスの Type を取得します。

(継承元 Object)
IsAlwaysNormalized()

既定の正規化形式を使用して、現在のエンコードが常に正規化されるかどうかを示す値を取得します。

(継承元 Encoding)
IsAlwaysNormalized(NormalizationForm)

派生クラスでオーバーライドされると、指定された正規化形式を使用して、現在のエンコードが常に正規化されるかどうかを示す値を取得します。

(継承元 Encoding)
MemberwiseClone()

現在の Objectの簡易コピーを作成します。

(継承元 Object)
ToString()

現在のオブジェクトを表す文字列を返します。

(継承元 Object)
TryGetBytes(ReadOnlySpan<Char>, Span<Byte>, Int32)

宛先が十分に大きい場合は、指定した読み取り専用スパンの文字セットをバイトスパンにエンコードします。

TryGetChars(ReadOnlySpan<Byte>, Span<Char>, Int32)

宛先が十分に大きい場合は、指定した読み取り専用スパンからバイトのセットを文字のスパンにデコードします。

拡張メソッド

名前 説明
GetBytes(Encoding, ReadOnlySequence<Char>, IBufferWriter<Byte>)

指定したReadOnlySequence<T>をデコードし、指定したbyteを使用してEncodingし、結果をwriterに書き込みます。

GetBytes(Encoding, ReadOnlySequence<Char>, Span<Byte>)

指定したReadOnlySequence<T>を使用して指定したbyteEncodingにエンコードし、結果をbytesに出力します。

GetBytes(Encoding, ReadOnlySequence<Char>)

指定したReadOnlySequence<T>を使用して、指定したByteEncoding配列にエンコードします。

GetBytes(Encoding, ReadOnlySpan<Char>, IBufferWriter<Byte>)

指定したReadOnlySpan<T>を使用して指定したbyteEncodingにエンコードし、結果をwriterに書き込みます。

GetChars(Encoding, ReadOnlySequence<Byte>, IBufferWriter<Char>)

指定したReadOnlySequence<T>をデコードし、指定したcharを使用してEncodingし、結果をwriterに書き込みます。

GetChars(Encoding, ReadOnlySequence<Byte>, Span<Char>)

指定したReadOnlySequence<T>をデコードし、指定したcharを使用してEncodingし、結果をcharsに出力します。

GetChars(Encoding, ReadOnlySpan<Byte>, IBufferWriter<Char>)

指定したReadOnlySpan<T>をデコードし、指定したcharを使用してEncodingし、結果をwriterに書き込みます。

GetString(Encoding, ReadOnlySequence<Byte>)

指定したReadOnlySequence<T>を使用して、指定したStringEncodingにデコードします。

適用対象

こちらもご覧ください