-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
38 lines (30 loc) · 790 Bytes
/
Program.cs
File metadata and controls
38 lines (30 loc) · 790 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
using System;
namespace testRef
{
class Program
{
class Ref
{
public int x;
}
struct Val
{
public int x;
}
static void Main ( string [ ] args )
{
Ref r1=new Ref();
Val v1=new Val();
r1.x = 5;
v1.x = 5;
Ref r2=r1;
Val v2=v1;
r2.x = 8;
v2.x = 9;
Console.WriteLine($"r1.x is {r1.x}");
Console.WriteLine($"v1.x is {v1.x}");
Console.WriteLine($"r2.x is {r2.x}");
Console.WriteLine($"v2.x is {v2.x}");
}
}
}