• Saves Valuable Time
  • Trusted Accuracy for 12 Years
  • 15-Day Money-Back Guarantee

C# Equivalent to VB 'ByRef' Parameters

VB C#
Public Sub refParamMethod(ByRef i As Integer)
    i = 1
End Sub

Public Sub callRefParamMethod()
    Dim i As Integer = 0
    refParamMethod(i)
End Sub
public void refParamMethod(ref int i)
{
    i = 1;
}

public void callRefParamMethod()
{
    int i = 0;
    refParamMethod(ref i); //'ref' keyword required in the call also
}


Use Instant C# to convert from VB.NET to C#.     

Additional resource: VB.NET and C# Equivalents


Copyright © 1997 – 2017 Tangible Software Solutions Inc.