-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathStaticPropertiesTest.linq
55 lines (43 loc) · 1.61 KB
/
StaticPropertiesTest.linq
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
47
48
49
50
51
52
53
54
55
<Query Kind="Program" />
void Main()
{
var test = new TestClass();
test.Execute();
test.Execute();
var test2 = new TestClass();
test.Execute();
test.Execute();
}
public class TestClass
{
private static string MyTestStaicString1 => TestMethod();
private static string MyTestStaicString2 => $"Yo2_{Counter2}";
private static string _MyTestStaicString3;
private static string MyTestStaicString3 { get { Counter3++; return _MyTestStaicString3; } set { _MyTestStaicString3 = value; } }
private static int Counter1;
private static int Counter2;
private static int Counter3;
public TestClass() {
MyTestStaicString3 = $"Yo3_{Counter3}";
}
public void Execute()
{
Console.WriteLine($"First call MyTestStaicString1 {MyTestStaicString1}");
Console.WriteLine($"First call MyTestStaicString2 {MyTestStaicString2}");
Console.WriteLine($"First call MyTestStaicString3 {MyTestStaicString3}");
Console.WriteLine($"Second call MyTestStaicString1 {MyTestStaicString1}");
Console.WriteLine($"Second call MyTestStaicString2 {MyTestStaicString2}");
Console.WriteLine($"Second call MyTestStaicString3 {MyTestStaicString3}");
Console.WriteLine($"Third call MyTestStaicString1 {MyTestStaicString1}");
Console.WriteLine($"Third call MyTestStaicString2 {MyTestStaicString2}");
Console.WriteLine($"Third call MyTestStaicString3 {MyTestStaicString3}");
Console.WriteLine($"Counter1 = {Counter1}");
Console.WriteLine($"Counter2 = {Counter2}");
Console.WriteLine($"Counter3 = {Counter3}");
}
private static string TestMethod() {
Counter1++;
Console.WriteLine(Counter1);
return $"Yo1!_{Counter1}";
}
}