File tree Expand file tree Collapse file tree
Tests/CSharp/ExpressionTests Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -325,6 +325,45 @@ public static Class1 Foo(ref Class1 c1)
325325 {
326326 return c1;
327327 }
328+ }" ) ;
329+ }
330+
331+ [ Fact ]
332+ public async Task AssignsBackToPropertyAsync ( )
333+ {
334+ await TestConversionVisualBasicToCSharpAsync ( @"Public Class RefTestClass
335+
336+ Private Property Prop1 As Integer
337+ Private Property Prop2 As Integer = 1
338+
339+ Private Sub TakesRef(ByRef vrbTst As Integer) As Boolean
340+ vrbTst = vrbTst + Prop2
341+ Return vrbTst > 1
342+ End Sub
343+
344+ Private Sub UsesRef(someInt As Integer)
345+ If TakesRef(Prop1) OrElse TakesRef(Prop2) AndAlso TakesRef(Prop1)
346+ someInt += 1
347+ End If
348+ End Sub
349+ End Class" , @"public class RefTestClass
350+ {
351+ private int Prop1 { get; set; }
352+ private int Prop2 { get; set; }
353+
354+ private bool TakesRef(ref int vrbTst)
355+ {
356+ vrbTst = vrbTst + Prop2;
357+ return vrbTst > 1;
358+ }
359+
360+ private void UsesRef(int someInt)
361+ {
362+ var argvrbTst = Prop;
363+ TakesRef(ref argvrbTst);
364+ Prop = argvrbTst; // Need to set value of property afterwards to maintain logic
365+ someInt += 1;
366+ }
328367}" ) ;
329368 }
330369 }
You can’t perform that action at this time.
0 commit comments