質問編集履歴

1

2019/04/15 03:01

投稿

Qoo
Qoo

スコア1249

test CHANGED
File without changes
test CHANGED
@@ -78,4 +78,54 @@
78
78
 
79
79
 
80
80
 
81
+ string LoadText(string path)
82
+
83
+     {
84
+
85
+         StringBuilder sb = new StringBuilder(1024);  //※capacity は任意
86
+
87
+
88
+
89
+         try
90
+
91
+         {
92
+
93
+             using (StreamReader reader = new StreamReader(path))
94
+
95
+             {
96
+
97
+                 while (!reader.EndOfStream)
98
+
99
+                 {
100
+
101
+                     string line = reader.ReadLine();
102
+
103
+                     sb.Append(line).Append("\n");
104
+
105
+                 }
106
+
107
+             }
108
+
109
+         }
110
+
111
+         catch (Exception e)
112
+
113
+         {
114
+
115
+             //Debug.Log(e.Message);
116
+
117
+             return null;
118
+
119
+         }
120
+
121
+
122
+
123
+         return sb.ToString();
124
+
125
+
126
+
127
+     }
128
+
129
+
130
+
81
131
  ```