What good is .SELECT in LINQ anyway? seems useless compared to.where

  • Thread starter Thread starter RayLopez99
  • Start date Start date
I have read that C# passes objects by reference. This doesn't seem to
be
the case given the program below. I expected it to print "second", but
it
prints "first".
Can anyone explain this behaviour?

This is because C# does not pass by reference as you have just shown.
C# passes object references by value.

You can get Call-by-reference behavior by using the ref keyword, if you want
 
RayLopez99 said:
I tried to compile the below code you posted in your website and it
failed. I think something needs to be commented out, like the first
four lines.

The first four lines are obviously an example of the text of the post,
before the code. There's no need to comment it out - it's not meant to
be compiled in the first place.

I don't believe I ever say that you should be able to cut and paste the
*whole* of a post and compile it - just the bit which is clearly code.
Oh well...do as i say, not as I do.

Perhaps you didn't spot the "given the program below" part of the text,
which makes it abundantly clear.
 
Bill Butler said:
This is because C# does not pass by reference as you have just shown.
C# passes object references by value.

You can get Call-by-reference behavior by using the ref keyword, if you want

Ray wasn't actually asking the question - he was quoting my example of
a post which contains a clear problem statement and then a short but
complete example program.
 
Perhaps you didn't spot the "given the program below" part of the text,
which makes it abundantly clear.

Everything is abundantly clear Jon, after the fact.

Hey I'll be heading to London this week to meet a client... we can
meet and have a pint. You'll see in real life I'm nothing like my
online persona. I'm really much, much more obnoxious. Never mind,
just kidding. About meeting that is.

Back to my coding...I'm doing a board game, and it's coming along
nicely. If I'm 80% proficient in C# now, I wonder what I'll be a year
from now, if I keep this up. I might even qualify to write a book.
But I cannot see how C# does internet stuff...I think you need a
database engine or ASP.NET for that...which I've just dipped my toe
in. C# should have a library class just for internet stuff IMO.


RL
 
proxyuser said:
Question: who is this guy and why is everyone continuing to put up with him?

This is usenet.

There is very little we can do about him.

I guess smarter people than me already have killfiled him.

Arne
 
RayLopez99 said:
Is this that Snippey tool you keep pushing Jon? I know it's your
pride and joy, as you keep mentioning it in your book. Too much
bother. Anybody with half a brain can cut and paste my code and make
it work with a few tweeks.

Probably.

But why should we spend time on it when you do not want to
spend time on it ?

Arne
 
RayLopez99 said:
I tried to compile the below code you posted in your website and it
failed. I think something needs to be commented out, like the first
four lines.

Oh well...do as i say, not as I do.

Nobody has asked you only to post code. We have just asked
you to post complete code.

Two very different things.

Arne
 
Arne Vajhøj said:
This is usenet.

There is very little we can do about him.

No one can stop him from posting, obviously. I'm just amazed he gets any
sincere help considering what a jackass he is.
 
I guess smarter people than me already have killfiled him.

So you admit you are stupid? Don't worry about it, we all make
mistakes. Actually I find some of your advice pretty good on
occasion.

RL
 
proxyuser said:
No one can stop him from posting, obviously. I'm just amazed he gets any
sincere help considering what a jackass he is.

Lots of nice people.

And that is a good thing.

Arne
 
Arne Vajhøj said:
Lots of nice people.

And that is a good thing.

And answering him could help other people having the same problem he has.
The fact that it is helping him as well can be considered just an
unfortunate side effect. ;)
 
Christophe said:
And answering him could help other people having the same problem he
has. The fact that it is helping him as well can be considered just an
unfortunate side effect. ;)

Yep.

Never underestimate the importance of the archives.

I am rather sure that more people benefit from answers
1 months after they were posted than <1 months after.
People have a problem, they Google and they find answers
in old usenet threads.

Arne
 
Christophe Lephay said:
And answering him could help other people having the same problem he has.
The fact that it is helping him as well can be considered just an
unfortunate side effect. ;)

Good point and well put :-)
 
Back
Top