Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VB.Net - Get the byte size of type

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 :)

like image 463
raed Avatar asked Jul 20 '15 07:07

raed


1 Answers

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))
like image 72
dennis95 Avatar answered Sep 30 '22 03:09

dennis95