回答編集履歴

1

コードを変更

2017/04/11 02:02

投稿

KSwordOfHaste
KSwordOfHaste

スコア18394

test CHANGED
@@ -22,15 +22,19 @@
22
22
 
23
23
  public static IEnumerable<byte> ReadBytes(this FileStream fs) {
24
24
 
25
+ byte[] buffer = new byte[4096];
26
+
25
27
  for (;;) {
26
28
 
27
- int b = fs.ReadByte();
29
+ int len = fs.Read(buffer, 0, buffer.Length);
28
30
 
29
- if (b < 0) break;
31
+ if (len == 0)
30
32
 
31
- yield return (byte)b;
33
+ break;
32
34
 
35
+ for (int i = 0; i < len; i++)
36
+
33
- }
37
+ yield return buffer[i];
34
38
 
35
39
  }
36
40