473,326 Members | 2,134 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

Object Size

Hi.

How do I get the size of the object at runtime? I tried Marshal.SizeOf, but
it fails with ArgumentException.

Suppose I want to do the following:

DataSet oDS = new DataSet();
// Get the size of oDS

Thanks.
J

--
Be Cool!
Aug 25 '05 #1
2 4313

"thejackofall" <th**********@discussions.microsoft.com> wrote in message
news:11**********************************@microsof t.com...
Hi.

How do I get the size of the object at runtime? I tried Marshal.SizeOf,
but
it fails with ArgumentException.

Suppose I want to do the following:

DataSet oDS = new DataSet();
// Get the size of oDS


There is no real way to get the size of an object tree at runtime, which is
waht I assume you want to do. Marshal.SizeOf returns the marshalled size
which is an inefficent estimate.

Aug 25 '05 #2
I am looking something equivalent to the sizeof() in C++.

With it, i can get the exact size of the object at runtime.

Thanks.
J

--
Be Cool!
"Daniel O'Connell [C# MVP]" wrote:

"thejackofall" <th**********@discussions.microsoft.com> wrote in message
news:11**********************************@microsof t.com...
Hi.

How do I get the size of the object at runtime? I tried Marshal.SizeOf,
but
it fails with ArgumentException.

Suppose I want to do the following:

DataSet oDS = new DataSet();
// Get the size of oDS


There is no real way to get the size of an object tree at runtime, which is
waht I assume you want to do. Marshal.SizeOf returns the marshalled size
which is an inefficent estimate.


Aug 25 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Ryan Mitchley | last post by:
Hi all I have code for an object factory, heavily based on an article by Jim Hyslop (although I've made minor modifications). The factory was working fine using g++, but since switching to the...
18
by: Tarundeep | last post by:
hi, let us say it is a 32 bit processor then the size of the pointer is 32 bits. now i want to know what would be the size of the class with vtable pointer in it , that is it has few virtual...
1
by: Bo Xu | last post by:
Object of Combination By Bo Xu Introduction A combination of n things, taken s at a time, often referred as an s-combination out of n, is a way to select a subset of size s from a given set of...
5
by: Greg | last post by:
Hi, I have been unable to resolve this error message: Object Ref not set to an instance of an object. The issue is that I cannot determine which object reference is causing the problem. ...
2
by: Ben | last post by:
I have several pages written in aspx, but sometime the aspx page return the following error. And it hapeen, the whole web application gives this error, that means all the aspx files get affected....
3
by: Adriano | last post by:
Hello, when I try to print something, either DataGrid or from Crystal Report viever the folowing error message appears and cancels printing: Object reference not set to an instance of an...
0
by: Deepak C.G via .NET 247 | last post by:
I want to dispose the image object in my child form, unless I won't dispose this object i can't delete the image file in my folder. I get this error in MDIparent form "An unhandled exception...
26
by: yb | last post by:
Hi, Is there a standard for the global 'window' object in browsers? For example, it supports methods such as setInterval and clearInterval, and several others. I know that w3c standardized...
6
by: Scirious | last post by:
People, how can I know how big an object is? I mean, I have an object the collects data from a stream and when it grows to an especific size I need to create a new object to continue collecting the...
23
by: tonytech08 | last post by:
What I like about the C++ object model: that the data portion of the class IS the object (dereferencing an object gets you the data of a POD object). What I don't like about the C++ object...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.