|
|
|
Unlike previous Visual Basic versions, under VB.NET you can't use the Len function to calculate the length of a Structure or a class. However, it is easy to get this information with the SizeOf static method of the System.Runtime.InteropServices.Mashal class, as in: |
Click here to copy the following block | Imports System.Runtime.InteropServices
Module Module1 Structure MyStruct Public el1 As Short Public el2 As Integer Public el3 As String End Structure
Sub Main(ByVal args() As String) Dim struct As mystruct Console.WriteLine(Marshal.SizeOf(struct)) End Sub End Module |
|
|
|
Submitted By :
Nayan Patel
(Member Since : 5/26/2004 12:23:06 PM)
|
|
|
Job Description :
He is the moderator of this site and currently working as an independent consultant. He works with VB.net/ASP.net, SQL Server and other MS technologies. He is MCSD.net, MCDBA and MCSE. In his free time he likes to watch funny movies and doing oil painting. |
View all (893) submissions by this author
(Birth Date : 7/14/1981 ) |
|
|