I am working on an application and converting existing ASP code to ASP.NET. The ASP page calls to COM components written in VB 6.0.
I have noticed that many of the methods are using ByRef keyword in some of the parameters. As per my understanding, ByRef modifies/updates the original parameter passed to the method.
I would like to change this functionality in .NET and don't want to use ByRef/ref/out parameters in functions as part of coding standards.
Can any one please suggest me what approach should I take? Do I need to logically divide the function into multiple functions so that ByRef keyword need not be used?
Any help would really be appreciated.
Harshad
----------------------------------------------------------
Please mark as answer if the post helped you.
riswadkarhar...
Contributor
2458 Points
561 Posts
VB 6 to .NET Migration use of ByRef
May 11, 2011 12:06 PM|LINK
Hi,
I am working on an application and converting existing ASP code to ASP.NET. The ASP page calls to COM components written in VB 6.0.
I have noticed that many of the methods are using ByRef keyword in some of the parameters. As per my understanding, ByRef modifies/updates the original parameter passed to the method.
I would like to change this functionality in .NET and don't want to use ByRef/ref/out parameters in functions as part of coding standards.
Can any one please suggest me what approach should I take? Do I need to logically divide the function into multiple functions so that ByRef keyword need not be used?
Any help would really be appreciated.
----------------------------------------------------------
Please mark as answer if the post helped you.
interwandere...
Contributor
2693 Points
542 Posts
Re: VB 6 to .NET Migration use of ByRef
May 11, 2011 01:51 PM|LINK
If these methods are subroutines, then you can change them in to functions and add a return parameter.
Otherwise, the out keyword is best..... thanks to this you will avoid using global parameters.... so byref wasn't such a bad approach at the time....
.one of my (older) projects social tomorrow and