回答編集履歴
2
修正
test
CHANGED
@@ -7,8 +7,8 @@
|
|
7
7
|
|
8
8
|
public interface IMachine
|
9
9
|
{
|
10
|
-
|
10
|
+
string CurrentStateName { get; }
|
11
|
-
|
11
|
+
void SendEvent(int evt);
|
12
12
|
}
|
13
13
|
|
14
14
|
public interface IStateful
|
@@ -35,9 +35,9 @@
|
|
35
35
|
public IMachine StateMachine => _stateMachine;
|
36
36
|
}
|
37
37
|
|
38
|
-
class Program
|
38
|
+
public class Program
|
39
39
|
{
|
40
|
-
static void Main(string[] args)
|
40
|
+
public static void Main(string[] args)
|
41
41
|
{
|
42
42
|
var stateful = new SampleClass();
|
43
43
|
var machine = stateful.StateMachine;
|
1
不要メソッド削除
test
CHANGED
@@ -18,7 +18,6 @@
|
|
18
18
|
|
19
19
|
public class ImtStateMachine<TEvent> : IMachine where TEvent : Enum
|
20
20
|
{
|
21
|
-
public IMachine GetStateMachine() => this;
|
22
21
|
public void SendEvent(TEvent evt) => Console.WriteLine($"SendEvent:{evt}");
|
23
22
|
public void SendEvent(int evt) => SendEvent(Unsafe.As<int, TEvent>(ref evt)); //Enumのベースがintである前提
|
24
23
|
public string CurrentStateName => "hogeStatus";
|