VB.Net - Get the byte size of type
Asked Answered
B

1

7

How can I get the byte size of a type ? For exemple, the size of a Double is 8, but how can I get this value programmatically ?

Thanks in advance :)

Beast answered 20/7, 2015 at 7:56 Comment(0)
R
5

You can use the Marshal.SizeOf-Method, which will return the size in bytes.

You can use it like that:

System.Runtime.InteropServices.Marshal.SizeOf(GetType(Double))
Ragen answered 20/7, 2015 at 8:22 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.