Add XML documentation for IFormFileCollection. #3528 (#1040)

This commit is contained in:
Roma Marusyk 2018-09-27 19:53:39 +03:00 committed by Chris Ross
parent 2422138ab4
commit cbed7393a2
2 changed files with 29 additions and 0 deletions

View File

@ -10,10 +10,33 @@ namespace Microsoft.AspNetCore.Http
/// </summary>
public interface IFormFileCollection : IReadOnlyList<IFormFile>
{
/// <summary>
/// Gets the file with the specified name.
/// </summary>
/// <param name="name">The name of the file to get.</param>
/// <returns>
/// The requested file, or null if it is not present.
/// </returns>
IFormFile this[string name] { get; }
/// <summary>
/// Gets the file with the specified name.
/// </summary>
/// <param name="name">The name of the file to get.</param>
/// <returns>
/// The requested file, or null if it is not present.
/// </returns>
IFormFile GetFile(string name);
/// <summary>
/// Gets an <see cref="IReadOnlyList{T}" /> containing the files of the
/// <see cref="IFormFileCollection" /> with the specified name.
/// </summary>
/// <param name="name">The name of the files to get.</param>
/// <returns>
/// An <see cref="IReadOnlyList{T}" /> containing the files of the object
/// that implements <see cref="IFormFileCollection" />.
/// </returns>
IReadOnlyList<IFormFile> GetFiles(string name);
}
}

View File

@ -6,10 +6,15 @@ using System.Collections.Generic;
namespace Microsoft.AspNetCore.Http.Internal
{
/// <summary>
/// Default implementation of <see cref="IFormFileCollection"/>.
/// </summary>
public class FormFileCollection : List<IFormFile>, IFormFileCollection
{
/// <inheritdoc />
public IFormFile this[string name] => GetFile(name);
/// <inheritdoc />
public IFormFile GetFile(string name)
{
foreach (var file in this)
@ -23,6 +28,7 @@ namespace Microsoft.AspNetCore.Http.Internal
return null;
}
/// <inheritdoc />
public IReadOnlyList<IFormFile> GetFiles(string name)
{
var files = new List<IFormFile>();