473,770 Members | 1,799 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Array Objects pointers, value types reference types??

Hi all,
I thought I understood .Net Framework with value types and
referencetypes but apparently not.
So I have this code. Excuse me if it's not 100% correct I cut and paste
and shortened it a bit to make things clearer
So basically the purpose of this code was to have to arrays passed in
byref _BInfo
and CInfo.
Then base on another list of items that gets passed through is to fill
one or the other.
I was wanting to use a array of objects pointer to "point" to BInfo or
CInfo Array

'Dim BInfo(,) As Object 'passed in byref
'Dim CInfo(,) As Object 'passed in byref
' Dim Mycoll as collection
Dim NodetoSet(,) As Object
Dim UpperBound As Integer

For Each X in Coll Loop ' Not important
If X.UseB Then
ReDim BINFO(30, UBound(BInfo) + 1)
NodetoSet = BINFO ' What is this doing. Is it
copying data from BINFO to NodetoSet why? Shouldn't it treat as a
pointer??
Else
ReDim CInfo(30, UBound(CInfo) + 1)
NodetoSet = CInfo ' What is this doing. Is it
copying data from BINFO to NodetoSet why? Shouldn't it treat as a
pointer??
End If
UpperBound = UBound(NodetoSe t, 2) - 1
'doing stuff with NodeToSet
NodeToSet(Upper Bound,1) = "hello"
NodeToSet(Upper Bound,1) = "goodbye" 'And so on....
Next
Thanks in advance

Feb 10 '06 #1
1 1269
pl*****@hotmail .com wrote:
Hi all,
I thought I understood .Net Framework with value types and
referencetypes but apparently not.
So I have this code. Excuse me if it's not 100% correct I cut and paste
and shortened it a bit to make things clearer
So basically the purpose of this code was to have to arrays passed in
byref _BInfo
and CInfo.
Then base on another list of items that gets passed through is to fill
one or the other.
I was wanting to use a array of objects pointer to "point" to BInfo or
CInfo Array

'Dim BInfo(,) As Object 'passed in byref
'Dim CInfo(,) As Object 'passed in byref
' Dim Mycoll as collection
Dim NodetoSet(,) As Object
Dim UpperBound As Integer

For Each X in Coll Loop ' Not important
If X.UseB Then
ReDim BINFO(30, UBound(BInfo) + 1)
NodetoSet = BINFO ' What is this doing. Is it
copying data from BINFO to NodetoSet why? Shouldn't it treat as a
pointer??
Else
ReDim CInfo(30, UBound(CInfo) + 1)
NodetoSet = CInfo ' What is this doing. Is it
copying data from BINFO to NodetoSet why? Shouldn't it treat as a
pointer??
End If
UpperBound = UBound(NodetoSe t, 2) - 1
'doing stuff with NodeToSet
NodeToSet(Upper Bound,1) = "hello"
NodeToSet(Upper Bound,1) = "goodbye" 'And so on....
Next
Thanks in advance


Ok, I can't say I fully understand what you are doing here, but I think
I see some issue that may help you.

1. 'Dim BInfo(,) As Object 'passed in byref
Objects will always be passed by reference. Only native data types are
able to be passed by value.

2. NodetoSet = BINFO
This is setting NodetoSet to the same as Binfo. They both point to the
same data object now.

Hope this helps.
Chris
Feb 10 '06 #2

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

Similar topics

58
10181
by: jr | last post by:
Sorry for this very dumb question, but I've clearly got a long way to go! Can someone please help me pass an array into a function. Here's a starting point. void TheMainFunc() { // Body of code... TCHAR myArray; DoStuff(myArray);
204
13101
by: Alexei A. Frounze | last post by:
Hi all, I have a question regarding the gcc behavior (gcc version 3.3.4). On the following test program it emits a warning: #include <stdio.h> int aInt2 = {0,1,2,4,9,16}; int aInt3 = {0,1,2,4,9};
32
6522
by: Joe Rattz | last post by:
Hmmm, I wrote the following code. I want an array of bools and I want to intialize them to false. bool bits = new bool; foreach(bool bit in bits) { bit = false; } The compiler complains on the "bit = false;" stating that bit is read-only.
14
2514
by: luis | last post by:
Are basic types (int, long, ...) objetcs or not? I read that in C# all are objects including basic types, derived from Object class. Then in msdn documentation says that boxing converts basic types in objects. But if they are objects why it´s need this conversion? Aren´t objects (basic types) like Java?
2
1731
by: Howard | last post by:
Hi, I've got a program whose main object contains an array of "cells", each of which contains an array of "sub-cells", each of which contains an array of "sub-sub-cells". The cells, subcells and subsubcells are three user-defined types, each of which contains some program logic as well as some drawing capabilities. Since all cells (and subcells and subsubcells) will utilize identical drawing "settings", I'm using a single settings...
11
13477
by: rayreeves | last post by:
How do I declare an array of references to the elements of an array of values? Ray
21
2215
by: George Exarchakos | last post by:
Hi everyone, I'd like your help... Can we have a std::list<BASEwhere BASE be the base class of a class hierarchy? I want to add to this list objects that are inherited from BASE class but not necessarily the same... class base { int x;
17
7254
by: =?Utf-8?B?U2hhcm9u?= | last post by:
Hi Gurus, I need to transfer a jagged array of byte by reference to unmanaged function, The unmanaged code should changed the values of the array, and when the unmanaged function returns I need to show the array data to the end user. Can I do that? How?
17
2326
by: Ben Bacarisse | last post by:
candide <toto@free.frwrites: These two statements are very different. The first one is just wrong and I am pretty sure you did not mean to suggest that. There is no object in C that is the same as its address. The second one simply depends on a term that is not well-defined. Most people consider the type to be an important part of the notion of
0
9454
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10257
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10099
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10037
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9904
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8931
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6710
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5482
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4007
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 we have to send another system

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.