-
Notifications
You must be signed in to change notification settings - Fork 2k
Expand file tree
/
Copy pathOutRef.cs
More file actions
46 lines (40 loc) · 765 Bytes
/
OutRef.cs
File metadata and controls
46 lines (40 loc) · 765 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
using System;
class OutRef
{
int Field;
void M()
{
int j = 0;
OutRefM(out int i, ref j);
Use(i);
Use(j);
OutRefM(out i, ref Field);
Use(i);
Use(Field);
OutRefM(out Field, ref Field);
Use(Field);
var t = new OutRef();
OutRefM(out Field, ref t.Field);
Use(Field);
Use(t.Field);
OutRefM2(out j, ref j);
Use(j);
OutRefM3(false, ref j);
Use(j);
}
void OutRefM(out int i, ref int j)
{
i = j;
j = 1;
}
void OutRefM2(out int i, ref int j)
{
i = j;
}
void OutRefM3(bool b, ref int j)
{
if (b)
j = 1;
}
static void Use<T>(T u) { }
}