Answering only the question about calling VB6 methods with parentheses, I remembered that you can force the ByRef ByVal parameter ByVal . While studying, I found that this still works in VB.NET.
However, I cannot find anything like it in C # that allows this. Last year, I had to refer to many VB.NET class libraries that accept ByRef no good reason (believe me, I checked). This forced me to set the properties of objects to local variables in order to pass them. Not a big problem, but not very clean if you ask me.
I am wondering if there is a syntax solution that I don't know about.
As an example of my current template, which I would like to avoid:
var tempSomeObject = BarObject.FooProperty; SomeVb6BusinessLogicMethod(ref tempSomeObject); // Continue to do work and set other temp objects due to ref constraint
In VB6 and VB.NET, you can simply do the following to force ByVal to use the ByRef parameter.
SomeVb6BusinessLogicMethod((BarObject.FooProperty)) 'Note the extra parens
EDIT: I am not asking about the differences between ByRef and ByVal. I ask if C # has a similar way to get the ByRef parameter to pass ByVal. See This MSDN Document for VB.NET Features. http://msdn.microsoft.com/en-us/library/chy4288y.aspx
source share