@@ -10,13 +10,56 @@ static StaticClass()
10
10
{
11
11
Console . WriteLine ( $ "Called static constructor of StaticClass, property { nameof ( Constant ) } = { Constant } ") ;
12
12
}
13
+
14
+ public static void Something ( )
15
+ {
16
+ Console . WriteLine ( $ "Something is going on...") ;
17
+ }
18
+ }
19
+
20
+ internal class RegularClassWithStaticMethods
21
+ {
22
+ public RegularClassWithStaticMethods ( )
23
+ {
24
+ Console . WriteLine ( "Hey! You woke me up! What do you want? I'm just a regular constructor..." ) ;
25
+ }
26
+
27
+ /// <summary>
28
+ /// Static constructor is only called once, even when instantiating a class
29
+ /// </summary>
30
+ static RegularClassWithStaticMethods ( )
31
+ {
32
+ Console . WriteLine ( "Hello! You have reached static constructor. How may I help you?" ) ;
33
+ }
34
+
35
+ public void RegularMethod ( )
36
+ {
37
+ Console . WriteLine ( "Meh! I'm just a regular method!" ) ;
38
+ }
39
+
40
+ public static void StaticMethod ( )
41
+ {
42
+ Console . WriteLine ( "Oh yeah! I'm a static method!" ) ;
43
+ }
13
44
}
14
45
15
46
public class StaticSample : SampleExecute
16
47
{
17
48
public override void Execute ( )
18
49
{
19
- throw new NotImplementedException ( ) ;
50
+ Title ( "StaticSampleExecute" ) ;
51
+
52
+ Section ( "Static Class" ) ;
53
+ StaticClass . Something ( ) ;
54
+
55
+ Section ( "Regular Class, Regular method" ) ;
56
+ var regularClass = new RegularClassWithStaticMethods ( ) ;
57
+ regularClass . RegularMethod ( ) ;
58
+
59
+ Section ( "Regular Class, Static method" ) ;
60
+ RegularClassWithStaticMethods . StaticMethod ( ) ;
61
+
62
+ Finish ( ) ;
20
63
}
21
64
}
22
65
}
0 commit comments