| File: NullFileProvider.cs | Web Access |
| Project: src\runtime\src\libraries\Microsoft.Extensions.FileProviders.Abstractions\src\Microsoft.Extensions.FileProviders.Abstractions.csproj (Microsoft.Extensions.FileProviders.Abstractions) |
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using Microsoft.Extensions.Primitives; namespace Microsoft.Extensions.FileProviders { /// <summary> /// An empty file provider with no contents. /// </summary> public class NullFileProvider : IFileProvider { /// <summary> /// Initializes a new instance of the <see cref="NullFileProvider"/> class. /// </summary> public NullFileProvider() { } /// <summary> /// Enumerates a nonexistent directory. /// </summary> /// <param name="subpath">A path under the root directory. This parameter is ignored.</param> /// <returns>A <see cref="IDirectoryContents"/> that does not exist and does not contain any contents.</returns> public IDirectoryContents GetDirectoryContents(string subpath) => NotFoundDirectoryContents.Singleton; /// <summary> /// Locates a nonexistent file. /// </summary> /// <param name="subpath">A path under the root directory.</param> /// <returns>A <see cref="IFileInfo"/> representing a nonexistent file at the given path.</returns> public IFileInfo GetFileInfo(string subpath) => new NotFoundFileInfo(subpath); /// <summary> /// Returns a <see cref="IChangeToken"/> that monitors nothing. /// </summary> /// <param name="filter">Filter string used to determine what files or folders to monitor. This parameter is ignored.</param> /// <returns>A <see cref="IChangeToken"/> that does not register callbacks.</returns> public IChangeToken Watch(string filter) => NullChangeToken.Singleton; } }