473,383 Members | 1,919 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,383 software developers and data experts.

Storing large amounts of object references

Just want to make sure I got this right...

Let's say I have a large array of A objects. Each A object has a
property that contains a reference to a B object. It would be possible
to store the property simply as a string, but I rather make the whole B
object available there. All the A objects may refer to the same B object.

To my understanding, when C# stores the reference to B objects in the A
object property, it just stores an address in memory, not the whole
object itself. So looping through the long list of A objects shouldn't
be slower than if I store the property as a string, right?

Gustaf
May 16 '06 #1
3 2160
right

--
"Gustaf" <gu*****@algonet.se> schrieb im Newsbeitrag
news:uE**************@TK2MSFTNGP05.phx.gbl...
Just want to make sure I got this right...

Let's say I have a large array of A objects. Each A object has a property
that contains a reference to a B object. It would be possible to store the
property simply as a string, but I rather make the whole B object
available there. All the A objects may refer to the same B object.

To my understanding, when C# stores the reference to B objects in the A
object property, it just stores an address in memory, not the whole object
itself. So looping through the long list of A objects shouldn't be slower
than if I store the property as a string, right?

Gustaf

May 16 '06 #2
Hi,

To my understanding, when C# stores the reference to B objects in the A
object property, it just stores an address in memory, not the whole object
itself. So looping through the long list of A objects shouldn't be slower
than if I store the property as a string, right?


It does store the address in memory or in other words a reference.

May 16 '06 #3
Right... so long as B is declared as a "class" and not as a "struct".
If B is declared as a "struct" then every A will have a separate copy
of B embedded in it. If B is declared as a "class" (which is what you
want) then every A will contain a reference (pointer) to its associated
B, and A's may share one or more B's.

May 16 '06 #4

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

Similar topics

2
by: flamesrock | last post by:
Hi, Basically, what I'm trying to do is store large amounts of data in a list or dictionary and then convert that to a custom formatted xml file. My list looks roughly like this: (d,r,p]]])...
1
by: dave123 | last post by:
I am using a access database to store data that is accesses by an asp web page. When I format a field as text the most that I can store in it is 255 characters. Is there a way of storing larger...
0
by: Michael Bredbury | last post by:
I am developing using Visual Studio .NET 2002 using ASP.NET and VB.NET. This is a web-based project which needs to install various ActiveX components on the users PC. ActiveX is needed because the...
6
by: Mudcat | last post by:
Hi, I am trying to build a tool that analyzes stock data. Therefore I am going to download and store quite a vast amount of it. Just for a general number - assuming there are about 7000 listed...
9
by: KarlM | last post by:
After reading some articles regarding confuguration data I'm a bit confused. Where is the right place for storing configuration data? - XML-files? - registry? - INI-files? (from a users point...
7
by: =?Utf-8?B?TW9iaWxlTWFu?= | last post by:
Hello everyone: I am looking for everyone's thoughts on moving large amounts (actually, not very large, but large enough that I'm throwing exceptions using the default configurations). We're...
4
by: bcomeara | last post by:
I am writing a program which needs to include a large amount of data. Basically, the data are p values for different possible outcomes from trials with different number of observations (the p...
17
by: Stubert | last post by:
I have a training module db that stores information about employees and what training they have carried our or need to carry out. One table in this database stores what training needs to be carried...
3
by: mk | last post by:
Hello everyone, I'm storing functions in a dictionary (this is basically for cooking up my own fancy schmancy callback scheme, mainly for learning purpose): .... return "f2 " + arg .......
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...
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.