UTF7Encoding.GetMaxCharCount メソッドとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > UTF7Encoding.GetMaxCharCount メソッドの意味・解説 

UTF7Encoding.GetMaxCharCount メソッド

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

名前空間: System.Text
アセンブリ: mscorlib (mscorlib.dll 内)
構文構文

Public Overrides Function
 GetMaxCharCount ( _
    byteCount As Integer _
) As Integer
Dim instance As UTF7Encoding
Dim byteCount As Integer
Dim returnValue As Integer

returnValue = instance.GetMaxCharCount(byteCount)
public override int GetMaxCharCount (
    int byteCount
)
public:
virtual int GetMaxCharCount (
    int byteCount
) override
public int GetMaxCharCount (
    int byteCount
)
public override function GetMaxCharCount (
    byteCount : int
) : int

パラメータ

byteCount

デコードするバイト数。

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

例外例外
例外種類条件

ArgumentOutOfRangeException

byteCount が 0 未満です。

または

結果文字数が、int として返すことのできる最大数を超えてます。

解説解説

GetChars が生成した文字格納するために必要な正確な配列サイズ計算するには、GetCharCount を使用します最大配列サイズ計算するには、GetMaxCharCount使用します通常GetMaxCharCount メソッドの方が高速実行されるのに対しGetCharCount メソッドの方が使用メモリ少なくて済みます

使用例使用例

次のコード例は、指定したバイト数をデコードすることによって生成される最大文字数を、GetMaxCharCount メソッド使用して計算する方法示してます。

Imports System
Imports System.Text

Class UTF7EncodingExample
    
    Public Shared Sub Main()
        Dim utf7 As New
 UTF7Encoding()
        Dim byteCount As Integer
 = 8
        Dim maxCharCount As Integer
 = utf7.GetMaxCharCount(byteCount)
        Console.WriteLine( _
            "Maximum of {0} characters needed to decode {1} bytes.",
 _
            maxCharCount, _
            byteCount _
        )
    End Sub 'Main
End Class 'UTF7EncodingExample
using System;
using System.Text;

class UTF7EncodingExample {
    public static void Main()
 {
        UTF7Encoding utf7 = new UTF7Encoding();
        int byteCount = 8;
        int maxCharCount = utf7.GetMaxCharCount(byteCount);
        Console.WriteLine(
            "Maximum of {0} characters needed to decode {1} bytes.",
            maxCharCount,
            byteCount
        );
    }
}
using namespace System;
using namespace System::Text;
int main()
{
   UTF7Encoding^ utf7 = gcnew UTF7Encoding;
   int byteCount = 8;
   int maxCharCount = utf7->GetMaxCharCount( byteCount );
   Console::WriteLine( "Maximum of {0} characters needed to decode {1} bytes.",
 maxCharCount, byteCount );
}

import System.*;
import System.Text.*;

class UTF7EncodingExample
{
    public static void main(String[]
 args)
    {
        UTF7Encoding utf7 = new UTF7Encoding();
        int byteCount = 8;
        int maxCharCount = utf7.GetMaxCharCount(byteCount);

        Console.WriteLine(
            "Maximum of {0} characters needed to decode {1} bytes.", 
            String.valueOf(maxCharCount), String.valueOf(byteCount));
    } //main
} //UTF7EncodingExample
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
UTF7Encoding クラス
UTF7Encoding メンバ
System.Text 名前空間
GetChars
GetString
GetCharCount
GetDecoder



英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

UTF7Encoding.GetMaxCharCount メソッドのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



UTF7Encoding.GetMaxCharCount メソッドのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2024 Microsoft.All rights reserved.

©2024 GRAS Group, Inc.RSS