tags:

views:

132

answers:

4

Hi All,

I have a C# function call which looks something like this:

var res = function ("arg1",   // argument# 1
                    "arg2",   // argument# 2
                    "arg3"    // argument# 3
                   );

the list of arguments is around 25 or so. It's a Web Services function, which I have no control over.

I'm trying to port it to VB.NET for another application and was wondering if VB.NET will let me call a function in this manner (with comments, if possible)?

A: 

It will not. You can use the built-in XML comments to add comments to the function declaration. In VS simply type "'''" above the function and it will automatically generate a comment body for you to fill out.

If you want to list your parameters on a function call in that way, you can use the line continuation character "_" following each parameter to list the function parameters.

Achilles
A: 

I believe you desire the _ line continuation character.

Will
Continued lines cannot contain comments, unfortunately, despite developers continuously requesting this feature since .NET 2003 beta 1.
Konrad Rudolph
@Kon Sucks to be VB.
Will
Not really, VB is the reason there is a C# :-D
Achilles
+3  A: 
Dim res = function("arg1", _
                  "arg2", _
                  "arg3" _
                    )

Will work, however you can't add comments to each line, as the _ character has to be the last character on the line.

Doogie
+1  A: 

FYI, the next version of VB will let you write the call like this:

Dim res = function("arg1",
                   "arg2",
                   "arg3"
                  )

I.e. without underscores to continue the lines.

Konrad Rudolph