Skip to content

Commit 52952e9

Browse files
committed
C#: Example source code with structurally same expressions and statements.
1 parent 4499551 commit 52952e9

File tree

1 file changed

+54
-0
lines changed

1 file changed

+54
-0
lines changed
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
using System;
2+
3+
public class Class
4+
{
5+
private readonly int x = 0;
6+
private readonly int y = 1;
7+
8+
public int M0() => 0;
9+
public int M1(int a) => a;
10+
public int M2(int v1, int v2) => v1 + v2;
11+
12+
13+
public void M3()
14+
{
15+
var z1 = x + y;
16+
var z2 = x + y;
17+
}
18+
19+
public void M4()
20+
{
21+
var z3 = M1(x);
22+
var z4 = M1(x);
23+
var z5 = M1(y);
24+
var z6 = M0();
25+
var z7 = M2(x, y) + M2(x, y);
26+
M2(x, y);
27+
M2(y, x);
28+
M2(y, x);
29+
}
30+
}
31+
32+
public class BaseClass
33+
{
34+
public int Field;
35+
public object Prop { get; set; }
36+
}
37+
38+
public class DerivedClass : BaseClass
39+
{
40+
public void M4()
41+
{
42+
var x1 = base.Field;
43+
var x2 = Field;
44+
var x3 = this.Field;
45+
}
46+
47+
public void M5()
48+
{
49+
var y1 = base.Prop;
50+
var y2 = Prop;
51+
var y3 = this.Prop;
52+
}
53+
}
54+

0 commit comments

Comments
 (0)