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

Is there an equivilent to VB.NET ByVal?

I was looking at a VB.NET program that is passing strings to method calls
using ByVal. I was wondering if this is for a reason and, if so, should a C#
conversion of code samples from VB.NET also use an equivilent rather than
passing strings by reference?
Nov 16 '05 #1
2 21714
The default parameter passing in C# is 'ByVal' as well - it's just there is
no keyword for it. ByVal means that a copy of the *reference* is passed.
Never is a copy of the object passed for reference types.

"John Galt" <nf*@nospam.com> wrote in message
news:eC**************@TK2MSFTNGP11.phx.gbl...
I was looking at a VB.NET program that is passing strings to method calls
using ByVal. I was wondering if this is for a reason and, if so, should a C# conversion of code samples from VB.NET also use an equivilent rather than
passing strings by reference?

Nov 16 '05 #2
John Galt <nf*@nospam.com> wrote:
I was looking at a VB.NET program that is passing strings to method
calls using ByVal. I was wondering if this is for a reason and, if
so, should a C# conversion of code samples from VB.NET also use an
equivilent rather than passing strings by reference?


Everything is passed by value in C# unless you specify otherwise. For
strings, this means the string reference is passed by value, because
string is a reference type.

See http://www.pobox.com/~skeet/csharp/parameters.html for more
information.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 16 '05 #3

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

Similar topics

4
by: Darren | last post by:
Hi. I have a javascript menu system which uses the "elementFromPoint" function. However Netscape/Mozilla doesn't recognise this function. Does it have an equivilent? Thanks -- Darren
4
by: trint | last post by:
I can't find the followings equivilent: flashPlayer.Movie = Application.StartupPath + @"/Cooler2.swf"; flashPlayer.FSCommand +=new...
2
by: Steve1 via DotNetMonster.com | last post by:
Hi all, I'm producing a data conversion app in C#. I have the code already written in VB6. I would to know if anyone knows of any links that shows the VB6 function/syntax equivilent in C#? ...
1
by: Ryan Ternier | last post by:
I'm trying to find an equivilent function to VB's DatePart function. I have a Year, Month, the Day of week (Sunday, monday etc.) and the week (week 1, week 2) and I need to find the date of that...
4
by: MikeLing | last post by:
Hi, String.IndexOf is case sensitive so I need to covert to lower before testing the string contains a given string. In VB this is: Instr(Lcase(StringToTest, "StringToCheckFor")) What is...
3
by: Abubakar | last post by:
Hi, I have used the Monitor/manualresetevent class in .net to sycnhronize threads in C#, right now I'm programming in pure c++ and win32 and want to acheive the same functionality. Whats the...
4
by: Chris Strug | last post by:
Hi, I'm working with VB 2005.net and have managed to get my head around passing values between forms by creating properties of the relevant form classes. However, say that I have a number of...
2
by: Brian Henry | last post by:
Is there a .NET equivilent of the "internal" keyword in VB.NET? say if i had this in C# internal bool b_MyBoolean;
2
by: =?Utf-8?B?QW5kcmV3IEhheWVz?= | last post by:
I have some legacy ASP code that looks like this: <% if not (Rs.EOF) then i=0 do while not Rs.EOF i=i+1 PaymentItemName = Rs("PaymentItemName") PaymentItemCode = Rs("PaymentItemCode") %>
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: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
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)...
1
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...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.