Link to home
Start Free TrialLog in
Avatar of milani_lucie
milani_lucieFlag for United States of America

asked on

How to find the Size of an object in VB.NET ?

Hi

I want to find the Size of an object in VB.NET. Can you please let me know how this can be done ? Similarly I want to find the Size of a string also in VB.NET. Can you please let me know how to do that ?

Thanks
Avatar of kaufmed
kaufmed
Flag of United States of America image

There is no way to get the size of an object in VB.NET. As for the string, the best you can do is Len(stringVariable), which returns the number of characters or then optimum number of bytes taken up by the string.
Could you be a little more specific?...what are you trying to do here?  Are you working with some external API that needs the size of something?
Avatar of milani_lucie

ASKER

I will have an ParentObject with SubObjects, during runtime i need to check the size of the ParentObject. If its size is more than 100 K then i do not want to do anything. If it is less than 100 K i want to do some operations on that.

Is there something like SIZEOF()  ?

Thanks
Avatar of srikanthreddyn143
srikanthreddyn143

I dnt think we have something like that. we have SizeOf But its for unmanaged code.For this
http://msdn.microsoft.com/en-us/library/y3ybkfb3.aspx

Normally you can serialize into binary and get the size of that binary value
srikanthreddyn143:

Normally you can serialize into binary and get the size of that binary value.

Can you please provide me the sample code ? Appreciate your time and patience !

Thanks

ASKER CERTIFIED SOLUTION
Avatar of srikanthreddyn143
srikanthreddyn143

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
why B Grade didn't it clear?