Skip to content
This repository was archived by the owner on Nov 20, 2018. It is now read-only.

Commit dfca389

Browse files
committed
Removed name closure, fixes last part of #352
1 parent 5f58bef commit dfca389

File tree

1 file changed

+21
-6
lines changed

1 file changed

+21
-6
lines changed

src/Microsoft.AspNet.Http/FormFileCollection.cs

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,34 @@ namespace Microsoft.AspNet.Http.Internal
77
{
88
public class FormFileCollection : List<IFormFile>, IFormFileCollection
99
{
10-
public IFormFile this[string name]
11-
{
12-
get { return GetFile(name); }
13-
}
10+
public IFormFile this[string name] => GetFile(name);
1411

1512
public IFormFile GetFile(string name)
1613
{
17-
return Find(file => string.Equals(name, file.Name));
14+
foreach (var file in this)
15+
{
16+
if (string.Equals(name, file.Name))
17+
{
18+
return file;
19+
}
20+
}
21+
22+
return null;
1823
}
1924

2025
public IReadOnlyList<IFormFile> GetFiles(string name)
2126
{
22-
return FindAll(file => string.Equals(name, file.Name));
27+
var files = new List<IFormFile>();
28+
29+
foreach (var file in this)
30+
{
31+
if (string.Equals(name, file.Name))
32+
{
33+
files.Add(file);
34+
}
35+
}
36+
37+
return files;
2338
}
2439
}
2540
}

0 commit comments

Comments
 (0)