For structures: VB.Len or Marshal.SizeOf

  • Thread starter Thread starter Just Me
  • Start date Start date
J

Just Me

I have some code converted from VB6 that contains VB.Len for structures.

VB.Len(lDevMode)

Seems to me that I can always change that to Marshal.SizeOf

Since sometimes Marshal.SizeOf works better

and VB.Len is never better.



Is that correct or are there cases when VB.Len is the correct one to use?





Thanks
 
Just Me said:
Since sometimes Marshal.SizeOf works better

and VB.Len is never better.



Is that correct or are there cases when VB.Len is the correct one to use?

In interop scenarios I would use 'Marshal.SizeOf' instead of 'Len'.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top