Parameter Passing - VB.Net v/s C#.Net

Parameter Passing - VB.Net  v/s  C#.Net

 

Visual Basic .NET uses ByVal for passing parameters by value, and uses ByRef for passing parameters by reference. Visual Basic .NET can also force parameters to be passed by value, regardless of how they are declared, by enclosing the parameters in extra parentheses. Visual Basic .NET also supports optional parameters, which are not available in Visual C# .NET.

Visual C# .NET does not have a way to pass reference types (objects) strictly by value. You can either pass the reference (basically a pointer) or a reference to the reference (a pointer to a pointer). Unmanaged Visual C# .NET methods can take pointers just like Visual C++ methods. To pass a parameter by reference, Visual C# .NET uses the ref keyword. To use a ref parameter, the argument must explicitly be passed to the method as a ref argument. The value of a ref argument is passed to the ref parameter.