File tree Expand file tree Collapse file tree
Tests/TestData/MultiFileCharacterization
VisualBasicUsesCSharpRefReturn
VBToCSResults/ConvertVbUsingCSharpRefReturnOnly/VisualBasicUsesCSharpRefReturn Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -14,5 +14,13 @@ public ref T this[int i] {
1414 return ref dummy ;
1515 }
1616 }
17+
18+ public ref T RefProperty
19+ {
20+ get
21+ {
22+ return ref dummy ;
23+ }
24+ }
1725 }
1826}
Original file line number Diff line number Diff line change 11Public Class ByRefArgument
22 Sub UseArr()
3- Dim arr() As Object
4- Modify(arr( 0 ))
3+ Dim arrObj() As Object
4+ Modify(arrObj( 0 ))
5+
6+ Dim arrInt() As Integer
7+ Modify(arrInt( 0 ))
58 End Sub
69
710 Sub UseRefReturn()
8- Dim lst As CSharpRefReturn.RefReturnList( Of Object )
9- Modify(lst( 0 ))
11+ Dim lstObj As CSharpRefReturn.RefReturnList( Of Object )
12+ Modify(lstObj( 0 ))
13+ Modify(lstObj.RefProperty)
14+
15+ Dim lstInt As CSharpRefReturn.RefReturnList( Of Integer )
16+ Modify(lstInt( 0 ))
17+ Modify(lstInt.RefProperty)
1018 End Sub
1119
1220 Sub Modify( ByRef o As Object )
Original file line number Diff line number Diff line change 1-
1+ using Microsoft . VisualBasic . CompilerServices ;
2+
23namespace VisualBasicUsesCSharpRefReturn
34{
45 public class ByRefArgument
56 {
67 public void UseArr ( )
78 {
8- var arr = default ( object [ ] ) ;
9- Modify ( ref arr [ 0 ] ) ;
9+ var arrObj = default ( object [ ] ) ;
10+ Modify ( ref arrObj [ 0 ] ) ;
11+
12+ var arrInt = default ( int [ ] ) ;
13+ var tmp = arrInt ;
14+ object argo = tmp [ 0 ] ;
15+ Modify ( ref argo ) ;
16+ tmp [ 0 ] = Conversions . ToInteger ( argo ) ;
1017 }
1118
1219 public void UseRefReturn ( )
1320 {
14- var lst = default ( CSharpRefReturn . RefReturnList < object > ) ;
15- Modify ( ref lst [ 0 ] ) ;
21+ var lstObj = default ( CSharpRefReturn . RefReturnList < object > ) ;
22+ Modify ( ref lstObj [ 0 ] ) ;
23+ Modify ( ref lstObj . RefProperty ) ;
24+
25+ var lstInt = default ( CSharpRefReturn . RefReturnList < int > ) ;
26+ var tmp = lstInt ;
27+ object argo = tmp [ 0 ] ;
28+ Modify ( ref argo ) ;
29+ tmp [ 0 ] = Conversions . ToInteger ( argo ) ;
30+ object argo1 = lstInt . RefProperty ;
31+ Modify ( ref argo1 ) ;
32+ lstInt . RefProperty = Conversions . ToInteger ( argo1 ) ;
1633 }
1734
1835 public void Modify ( ref object o )
You can’t perform that action at this time.
0 commit comments