掲示板システム
ホーム
アクセス解析
カテゴリ
ログアウト
VB.NETでユーザー定義型のメモリ内でのサイズを取得する方法 (ID:114998)
名前
ホームページ(ブログ、Twitterなど)のURL (省略可)
本文
> あれ?おかしいね。これ。Integer が奇数個あると変だ。 そうですか? 当方では、期待値を返してきていますよ。 '------------------------------------------------------ ' Marshal.SizeOf(GetType(SizeInfo)) = 40 '------------------------------------------------------ Private Structure SizeInfo Dim intSizeA As Integer '…4バイト '…4バイト パディング Dim decSizeB As Decimal '…16バイト Dim decSizeC As Decimal '…16バイト End Structure '------------------------------------------------------ ' Marshal.SizeOf(GetType(SizeInfo)) = 40 '------------------------------------------------------ Private Structure SizeInfo Dim intSizeA As Integer '…4バイト Dim intSizeB As Integer '…4バイト Dim decSizeC As Decimal '…16バイト Dim decSizeD As Decimal '…16バイト End Structure '------------------------------------------------------ ' Marshal.SizeOf(GetType(SizeInfo)) = 48 '------------------------------------------------------ Private Structure SizeInfo Dim intSizeA As Integer '…4バイト '…4バイト パディング Dim decSizeB As Decimal '…16バイト Dim intSizeC As Integer '…4バイト '…4バイト パディング Dim decSizeD As Decimal '…16バイト End Structure '------------------------------------------------------ ' Marshal.SizeOf(GetType(SizeInfo)) = 48 '------------------------------------------------------ Private Structure SizeInfo Dim intSizeA As Integer '…4バイト '…4バイト パディング Dim decSizeB As Decimal '…16バイト Dim decSizeC As Decimal '…16バイト Dim intSizeD As Integer '…4バイト '…4バイト パディング End Structure '------------------------------------------------------ ' Marshal.SizeOf(GetType(SizeInfo)) = 40 '------------------------------------------------------ <StructLayout(LayoutKind.Sequential, Pack:=4)> _ Private Structure SizeInfo Dim intSizeA As Integer '…4バイト Dim decSizeB As Decimal '…16バイト Dim decSizeC As Decimal '…16バイト Dim intSizeD As Integer '…4バイト End Structure '------------------------------------------------------ ' Marshal.SizeOf(GetType(SizeInfo)) = 36 '------------------------------------------------------ <StructLayout(LayoutKind.Sequential, Pack:=4)> _ Private Structure SizeInfo Dim intSizeA As Integer '…4バイト Dim decSizeB As Decimal '…16バイト Dim decSizeC As Decimal '…16バイト End Structure
←解決時は質問者本人がここをチェックしてください。
戻る
掲示板システム
Copyright 2020 Takeshi Okamoto All Rights Reserved.