Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / C# / August 2007

Tip: Looking for answers? Try searching our database.

By Reference

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Lit - 09 Aug 2007 01:18 GMT
Hi,

when passing by reference through multiple layers or AppDomains or outProc,
servers or external domains over the web.

Is it truly by Reference or at some boundaries things are marshaled and
passed by Value?

Lets say we are passing by Ref from server A to server B to server C etc...

What is happening?

Thank you,

Lit
Göran Andersson - 09 Aug 2007 01:34 GMT
> Hi,
>
[quoted text clipped - 7 lines]
>
> What is happening?

Obviously you are not sending a pointer to the variable, as that would
be useless on a different computer. The value of the variable is sent
and a new value is returned, which is stored in the variable.

Passing by reference actually doesn't have to use a pointer in any
situation at all. The value of the variable is only guaranteed to be
updated when the method returns, the compiler can implement this by
sending the value of the variable and updating the variable on return
whenever that is more efficient.

Signature

Göran Andersson
_____
http://www.guffa.com

Lit - 09 Aug 2007 19:51 GMT
Hi Goran,

To be clear, so based on some compiler logic it may or may not pass a
pointer at all?
Does that include passing some reference to an Object also?  or anything.

Thanks for your input.

Lit

>> Hi,
>>
[quoted text clipped - 18 lines]
> sending the value of the variable and updating the variable on return
> whenever that is more efficient.
Göran Andersson - 10 Aug 2007 11:12 GMT
> To be clear, so based on some compiler logic it may or may not pass a
> pointer at all?

Correct. It's only defined what the result is, not how it's implemented.

> Does that include passing some reference to an Object also?  or anything.

Passing a reference is completely different from passing a variable by
reference. If you write code to pass a reference, a reference will be
passed.

Signature

Göran Andersson
_____
http://www.guffa.com

Lit - 10 Aug 2007 15:51 GMT
Goran,

Excellent, Thank you.

Do you have a C, C++ background  or -beyond?

Thanks again,

Lit

>> To be clear, so based on some compiler logic it may or may not pass a
>> pointer at all?
[quoted text clipped - 6 lines]
> reference. If you write code to pass a reference, a reference will be
> passed.
Göran Andersson - 10 Aug 2007 21:29 GMT
> Goran,
>
[quoted text clipped - 5 lines]
>
> Lit

A have a background in Atari Basic, Compis Pascal, 6502 machine code,
Comal, Pascal, C, Fortran, Cobol, GFA Basic, 68000 Assembler, Turbo
Pascal, 80x86 Assembler, C++, VBScript, VB6, Javascript, C#.

:)

Signature

Göran Andersson
_____
http://www.guffa.com


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.