[AccessD] DotNet passing by value

Charlotte Foust cfoust at infostatsystems.com
Fri Aug 26 11:05:58 CDT 2005


John,

It's true and it isn't.  You can pass arguments ByRef in .Net, but it
isn't the default.  And ByVal isn't the same in .Net as it was in
VB/VBA.  The VS.Net help contains a topic called "Parameter Passing
Mechanism Changes in Visual Basic" that you can find by typing "ByRef
keyword, what's changed" in the Look for: box under the index tab.

Charlotte Foust


-----Original Message-----
From: John W. Colby [mailto:jwcolby at colbyconsulting.com] 
Sent: Friday, August 26, 2005 4:10 AM
To: dba-vb at databaseadvisors.com; 'Access Developers discussion and
problemsolving'
Subject: [AccessD] DotNet passing by value


As you might be aware, VB.Net (and I assume the other .net languages as
well) pass all variables by value.  But what does this mean, and is it
true. As you know, everything in .net is an object, even common
variables such as an integer or decimal etc.  Passing by value (in other
languages) means placing a COPY of the variable (or object in this case)
on the stack as the function is called.  In VBA for example, when you
pass by value, it really does ONLY for the simple data types, passing
anything else (including
strings) by value.  

Imagine passing a string, which could be a million bytes, by value -
literally making a copy and passing that into the stack.  IIRC the total
stack space for a given program in an Intel machine is something like
128 kbytes which means that passing a single (huge) string by value
could cause a stack overflow.  Now DotNet comes along claiming to pass
everything by value.  Is this more doublespeak?  And if so, what is the
truth?

John W. Colby
www.ColbyConsulting.com 

Contribute your unused CPU cycles to a good cause:
http://folding.stanford.edu/


-- 
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com



More information about the AccessD mailing list