UTF7Encoding.GetMaxByteCount メソッド
アセンブリ: mscorlib (mscorlib.dll 内)

Dim instance As UTF7Encoding Dim charCount As Integer Dim returnValue As Integer returnValue = instance.GetMaxByteCount(charCount)
戻り値
指定した文字数をエンコードすることによって生成される最大バイト数。


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

次のコード例は、指定した文字数をエンコードするために必要な最大バイト数を、GetMaxByteCount メソッドを使用して計算する方法を示しています。
Imports System Imports System.Text Class UTF7EncodingExample Public Shared Sub Main() Dim utf7 As New UTF7Encoding() Dim charCount As Integer = 2 Dim maxByteCount As Integer = utf7.GetMaxByteCount(charCount) Console.WriteLine( _ "Maximum of {0} bytes needed to encode {1} characters.", _ maxByteCount, _ charCount _ ) End Sub 'Main End Class 'UTF7EncodingExample
using System; using System.Text; class UTF7EncodingExample { public static void Main() { UTF7Encoding utf7 = new UTF7Encoding(); int charCount = 2; int maxByteCount = utf7.GetMaxByteCount(charCount); Console.WriteLine( "Maximum of {0} bytes needed to encode {1} characters.", maxByteCount, charCount ); } }
using namespace System; using namespace System::Text; int main() { UTF7Encoding^ utf7 = gcnew UTF7Encoding; int charCount = 2; int maxByteCount = utf7->GetMaxByteCount( charCount ); Console::WriteLine( "Maximum of {0} bytes needed to encode {1} characters.", maxByteCount, charCount ); }
import System.*; import System.Text.*; class UTF7EncodingExample { public static void main(String[] args) { UTF7Encoding utf7 = new UTF7Encoding(); int charCount = 2; int maxByteCount = utf7.GetMaxByteCount(charCount); Console.WriteLine( "Maximum of {0} bytes needed to encode {1} characters.", String.valueOf(maxByteCount), String.valueOf(charCount)); } //main } //UTF7EncodingExample

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


Weblioに収録されているすべての辞書からUTF7Encoding.GetMaxByteCount メソッドを検索する場合は、下記のリンクをクリックしてください。

- UTF7Encoding.GetMaxByteCount メソッドのページへのリンク