指定した配列のバイト数を返します。
Public Shared Function ByteLength( _
ByVal array As Array _) As Integer
[C#]
public static int ByteLength(Arrayarray);
[C++]
public: static int ByteLength(Array* array);
[JScript]
public static function ByteLength(
array : Array) : int;
パラメータ
- array
配列。
戻り値
配列のバイト数。
例外
例外の種類 | 条件 |
---|---|
ArgumentNullException | array が null 参照 (Visual Basic では Nothing) です。 |
ArgumentException | array がプリミティブではありません。 |
使用例
Dim arr() As Integer = {0, 1, 2, 3, 4}
Debug.Assert(Buffer.ByteLength(arr) = 20)
Dim i As Integer
For i = 0 To Buffer.ByteLength(arr) - 1
Console.Write(arr(i))
Next i
'This will print: 00000001000200030004
[C#]
int [] arr = new int [5] {0, 1, 2, 3, 4};
Debug.Assert (Buffer.ByteLength(arr) == 20);
for (int i = 0; i < Buffer.ByteLength(arr); i++)
{
Console.Write(arr[i]);
}
//This will print: 00000001000200030004
[C++]
Int32 arr[] = {0, 1, 2, 3, 4};
Debug::Assert (Buffer::ByteLength(arr) == 20);
for (int i = 0; i < Buffer::ByteLength(arr); i++)
{
Console::Write(arr[i]);
}
//This will print: 00000001000200030004
[JScript] JScript のサンプルはありません。Visual Basic、C#、および C++ のサンプルを表示するには、このページの左上隅にある言語のフィルタ ボタン をクリックします。
必要条件
プラットフォーム: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 ファミリ, .NET Compact Framework - Windows CE .NET