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

Some bogus examples and statements

Why is it that most of the articles found on the net (written by
professional authors) and books (such as Sams .NET CLR Unleashed) give
bogus examples and state incorrectly that "reference-types are passed by
reference" in C#? They are *not*. Almost out of 10 articles, 9 make such
a statement. Recently I read an article by Jeffrey Ritcher on Arrays in
..NET, under the Passing and returning Arrays section it states "Arrays
are always passed by reference to a method" as the first line. I thought
Jeffrey would know better? Don't people at MSDN proof read these
articles? Isn't that claim wrong? What's the matter with people!

-Andre

Nov 15 '05 #1
3 1706
> In the context of the article and the point JR is trying to make, I think
his statement is fair. At the lowest level, method arguments may be passed
by value, but when you look at it from a higher level of abstraction, the
method does receive a reference to the original array.
True.. but saying 'Arrays are always passed by reference'.. the stress
here is on the phrase 'passing by reference' as we all know.. 'passing
by reference' has a strict and exact meaning in C# and I think it's a
little misleading. I'm sure adding another line saying: All types in C#
are passed by value. Given that a reference type variable holds a
reference to the actual object, in case of arrays (which is a reference
type), a copy of the reference held by the array variable is passed onto
the method (i.e by value) and so method now has a local variable holding
a copy of the reference referring to the actual array on the heap.

I'm sure the above could be further summarized .. my point is... saying
"passed by reference" is incorrect especially when it holds a specific
meaning to the language.

The key point being that a copy of the array IS NOT made and passed to the method.
Exactly.. you described it to me in a line, so could JR, right? He *did*
write a lenghty article only on Arrays, and I'm sure clarifying a few
lines wouldn't have hurt.
I can assure you that the people at MSDN do proof read articles and if JR
had of said "Arrays are always passed by value to a method...", then
somebody would have been asking questions; yourself included no doubt.
Not really - unless what you stated wouldn't have been further explained
(by a small example perhaps?)
of being a good writer is knowing what to include and what not to include.
In the case of this article, to accurately describe how things really work,
would have required JR to branch off into a side discussion that was out of
context, confusing for the reader, and added little to the article.


Confusing? I disagree. Since I'd read the article only to learn more
about arrays in the first place, I'd love to read a bit more (especially
when it really really matters). One branches off when the discussion at
hand is indirectly or in some way not related to the main topic.

The 9 articles I talked about can be found on websites such as
codeproject.com or other websites that host articles written on C# (I
readlly don't remember - but I can find them for you if you really want
to know).

-Andre

Nov 15 '05 #2
Andre,

Couldn't you try to give an example where your attempt for clarification
actually settles an ambiguity or generally solves an issue?
Best regards,

Henrik Dahl

"Andre" <fo********@hotmail.com> wrote in message
news:3f********@clarion.carno.net.au...
In the context of the article and the point JR is trying to make, I think his statement is fair. At the lowest level, method arguments may be passed by value, but when you look at it from a higher level of abstraction, the method does receive a reference to the original array.


True.. but saying 'Arrays are always passed by reference'.. the stress
here is on the phrase 'passing by reference' as we all know.. 'passing
by reference' has a strict and exact meaning in C# and I think it's a
little misleading. I'm sure adding another line saying: All types in C#
are passed by value. Given that a reference type variable holds a
reference to the actual object, in case of arrays (which is a reference
type), a copy of the reference held by the array variable is passed onto
the method (i.e by value) and so method now has a local variable holding
a copy of the reference referring to the actual array on the heap.

I'm sure the above could be further summarized .. my point is... saying
"passed by reference" is incorrect especially when it holds a specific
meaning to the language.

The key point being
that a copy of the array IS NOT made and passed to the method.


Exactly.. you described it to me in a line, so could JR, right? He *did*
write a lenghty article only on Arrays, and I'm sure clarifying a few
lines wouldn't have hurt.
I can assure you that the people at MSDN do proof read articles and if JR had of said "Arrays are always passed by value to a method...", then
somebody would have been asking questions; yourself included no doubt.


Not really - unless what you stated wouldn't have been further explained
(by a small example perhaps?)
of being a good writer is knowing what to include and what not to include. In the case of this article, to accurately describe how things really work, would have required JR to branch off into a side discussion that was out of context, confusing for the reader, and added little to the article.


Confusing? I disagree. Since I'd read the article only to learn more
about arrays in the first place, I'd love to read a bit more (especially
when it really really matters). One branches off when the discussion at
hand is indirectly or in some way not related to the main topic.

The 9 articles I talked about can be found on websites such as
codeproject.com or other websites that host articles written on C# (I
readlly don't remember - but I can find them for you if you really want
to know).

-Andre

Nov 15 '05 #3
Andre,

But is it possible for you to illustrate a situation where you've clarified
something in what you write?
Best regards,

Henrik Dahl

"Andre" <fo********@hotmail.com> wrote in message
news:3F************@hotmail.com...
:) Well... actually no I dont have a solution.. I can't stop people from
writing what they will but I was hoping MSDN would be more careful next
time :)
-Andre

Henrik Dahl wrote:
Andre,

Couldn't you try to give an example where your attempt for clarification
actually settles an ambiguity or generally solves an issue?
Best regards,

Henrik Dahl

"Andre" <fo********@hotmail.com> wrote in message
news:3f********@clarion.carno.net.au...
In the context of the article and the point JR is trying to make, I

think
his statement is fair. At the lowest level, method arguments may be

passed
by value, but when you look at it from a higher level of abstraction,

the
method does receive a reference to the original array.

True.. but saying 'Arrays are always passed by reference'.. the stress
here is on the phrase 'passing by reference' as we all know.. 'passing
by reference' has a strict and exact meaning in C# and I think it's a
little misleading. I'm sure adding another line saying: All types in C#
are passed by value. Given that a reference type variable holds a
reference to the actual object, in case of arrays (which is a reference
type), a copy of the reference held by the array variable is passed onto
the method (i.e by value) and so method now has a local variable holding
a copy of the reference referring to the actual array on the heap.

I'm sure the above could be further summarized .. my point is... saying
"passed by reference" is incorrect especially when it holds a specific
meaning to the language.

The key point being

that a copy of the array IS NOT made and passed to the method.

Exactly.. you described it to me in a line, so could JR, right? He *did*
write a lenghty article only on Arrays, and I'm sure clarifying a few
lines wouldn't have hurt.
I can assure you that the people at MSDN do proof read articles and if

JR
had of said "Arrays are always passed by value to a method...", then
somebody would have been asking questions; yourself included no doubt.

Not really - unless what you stated wouldn't have been further explained
(by a small example perhaps?)
of being a good writer is knowing what to include and what not to

include.
In the case of this article, to accurately describe how things really

work,
would have required JR to branch off into a side discussion that was out

of
context, confusing for the reader, and added little to the article.

Confusing? I disagree. Since I'd read the article only to learn more
about arrays in the first place, I'd love to read a bit more (especially
when it really really matters). One branches off when the discussion at
hand is indirectly or in some way not related to the main topic.

The 9 articles I talked about can be found on websites such as
codeproject.com or other websites that host articles written on C# (I
readlly don't remember - but I can find them for you if you really want
to know).

-Andre


Nov 15 '05 #4

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

Similar topics

0
by: Trophy Thief | last post by:
I'm getting an odd error when I try to run a select statement in my stored procedure. I need to select records where one field = the first host variable, and the second host variable is between the...
193
by: Michael B. | last post by:
I was just thinking about this, specifically wondering if there's any features that the C specification currently lacks, and which may be included in some future standardization. Of course, I...
66
by: KimmoA | last post by:
Hey! Some questions about C that have been bugging me for a while... 1) Is inline a valid C keyword or not? I was kind of surprised of not finding it in C, to be honest. My "The C Programming...
30
by: GeorgeRXZ | last post by:
Hi Friends, I have some questions related to C Language. 1What is the difference between the standard C language and Non standard C language ? 2which is better C Lanugage, C under Linux/...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
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...
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)...
0
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
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

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.