473,509 Members | 2,900 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Easy question about array

Hello!

As I have understood this it means the following. Correct me if I'm wrong.
You store type objects in the array obj and the first one is refering to
a and the second is refering to b and the third is refering to c.
You store reference types of type object in the array but all of them is
refering to value types(a,b,c)

int32 a = 0;
Byte b = 0;
int16 c = 0;
object[] obj = {a,b,c};

It's the same as saying
object o1 = a;
object o2 = b;
object o3 = c;

//Tony

Sep 22 '08 #1
2 1007
On 22 Sep, 17:44, "Tony Johansson" <t.johans...@logica.comwrote:
Hello!

As I have understood this it means the following. Correct me if I'm wrong..
You store type objects in the array obj and the first one is refering to
a and the second is refering to b and the third is refering to c.
You store reference types of type object in the array but all of them is
refering to value types(a,b,c)

int32 *a = 0;
Byte *b = 0;
int16 *c = 0;
object[] obj = {a,b,c};

It's the same as saying
object o1 = a;
object o2 = b;
object o3 = c;

//Tony
Array is a reference type, which holds a series of reference objects
or value type objects.

to know more http://msdn.microsoft.com/en-us/libr...53(VS.71).aspx

-Cnu
Sep 22 '08 #2
Tony Johansson wrote:
Hello!

As I have understood this it means the following. Correct me if I'm wrong.
You store type objects in the array obj and the first one is refering to
a and the second is refering to b and the third is refering to c.
You store reference types of type object in the array but all of them is
refering to value types(a,b,c)

int32 a = 0;
Byte b = 0;
int16 c = 0;
object[] obj = {a,b,c};

It's the same as saying
object o1 = a;
object o2 = b;
object o3 = c;

//Tony
Yes, that is correct.

To store the values in the array, each value is boxed inside an object
that is allocated on the heap.

--
Göran Andersson
_____
http://www.guffa.com
Sep 22 '08 #3

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

Similar topics

3
1334
by: Captain Nemo | last post by:
Hi I'm trying to build a simple, one-dimensional array of prices, where the key to each element is the product code. So I start by executing a select query "SELECT Code, Price FROM Products",...
7
2730
by: Tino Lange | last post by:
Hi! I identified a bottleneck in my programs. I just want to "encrypt" data by easy xoring. Ok - that's no encryption at all - I know. But it's hardly readable - and that's enough :-) Just...
5
2339
by: Hamish Dean | last post by:
Hi. I want to pass an array through a function. how do i do this? eg. void SomeFunction(){ int Array; Array = 1; Array = 2; Array = 3;
5
1544
by: Harold Howe | last post by:
Howdy, 1- Are property reads in effect volatile? Or is the compiler allowed to optimize property reads away? ie class foo { public int bar { get { return m_bar;}
18
39962
by: Mike Bartels | last post by:
Hi Everyone! I have two Arrays A and B. Both arrays are byte arrays with 7 bytes each. The contents of array A and B are the same A = {1, 2, 3, 4, 5, 6, 7}; B = {1, 2, 3, 4, 5, 6, 7}; When...
3
2322
by: Rob Meade | last post by:
Hi all, I have a login page which has username and password fields, a login button, and 2 validation controls (one for each field) - currently I have controls to display to the summary if the...
7
1433
by: jimi_xyz | last post by:
I am kind of new to C sharp; I have a quick question I have multiple text boxes 12 of them to be exact. What I want to do is fill them with values that are in a array of integers. The way I am...
7
1977
by: David Lowndes | last post by:
I've got a project with a fair bit of mixed C++/CLI calling native code, often passing raw pointers - and I'm worrying that we may have occasions where we don't use pin_ptr when we need to. ...
1
1593
by: paulf.johnson | last post by:
Hi, For some reason, my brain has gone to mush on a couple of things. Any help would be appreciated. I have an array and a field passed into a function (call it $v) which is a string composed...
0
7136
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
1
7069
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7505
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5652
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4730
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3216
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1570
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
775
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
441
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.