回答編集履歴
1
修正
test
CHANGED
@@ -1,5 +1,57 @@
|
|
1
|
-
|
1
|
+
たぶんこういうことか。
|
2
2
|
|
3
3
|
|
4
4
|
|
5
|
+
```csharp
|
6
|
+
|
7
|
+
using System;
|
8
|
+
|
9
|
+
using System.Linq;
|
10
|
+
|
11
|
+
using System.Reflection;
|
12
|
+
|
13
|
+
|
14
|
+
|
15
|
+
namespace ConsoleApp1
|
16
|
+
|
17
|
+
{
|
18
|
+
|
19
|
+
internal class Program
|
20
|
+
|
21
|
+
{
|
22
|
+
|
23
|
+
private static void Main(string[] args)
|
24
|
+
|
25
|
+
{
|
26
|
+
|
27
|
+
string enumStr = "Season";
|
28
|
+
|
5
|
-
|
29
|
+
var t = Assembly.GetExecutingAssembly().GetTypes().Where(x => x.Name == enumStr).FirstOrDefault();
|
30
|
+
|
31
|
+
var strVal = "spring";
|
32
|
+
|
33
|
+
var enmVal = Enum.Parse(t, strVal, true);
|
34
|
+
|
35
|
+
}
|
36
|
+
|
37
|
+
|
38
|
+
|
39
|
+
public enum Season
|
40
|
+
|
41
|
+
{
|
42
|
+
|
43
|
+
Spring = 0x01,
|
44
|
+
|
45
|
+
Summer = 0x02,
|
46
|
+
|
47
|
+
Autumn = 0x04,
|
48
|
+
|
49
|
+
Winter = 0x08
|
50
|
+
|
51
|
+
}
|
52
|
+
|
53
|
+
}
|
54
|
+
|
55
|
+
}
|
56
|
+
|
57
|
+
```
|