CompositeFileProvider Class¶
Looks up files using a list of Microsoft.Extensions.FileProviders.IFileProvider
.
- Namespace
Microsoft.Extensions.FileProviders
- Assemblies
- Microsoft.Extensions.FileProviders.Composite
Syntax¶
public class CompositeFileProvider : IFileProvider
-
class
Microsoft.Extensions.FileProviders.
CompositeFileProvider
Constructors¶
-
CompositeFileProvider
(Microsoft.Extensions.FileProviders.IFileProvider[])¶ Initializes a new instance of the
Microsoft.Extensions.FileProviders.CompositeFileProvider
class using a list of file provider.public CompositeFileProvider(params IFileProvider[] fileProviders)
-
CompositeFileProvider
(System.Collections.Generic.IEnumerable<Microsoft.Extensions.FileProviders.IFileProvider>) Initializes a new instance of the
Microsoft.Extensions.FileProviders.CompositeFileProvider
class using a list of file provider.public CompositeFileProvider(IEnumerable<IFileProvider> fileProviders)
-
Properties¶
-
Microsoft.Extensions.FileProviders.CompositeFileProvider.
FileProviders
¶ Gets the list of configured
Microsoft.Extensions.FileProviders.IFileProvider
instances.Return type: System.Collections.Generic.IEnumerable<Microsoft.Extensions.FileProviders.IFileProvider> public IEnumerable<IFileProvider> FileProviders { get; }
-
Methods¶
-
GetDirectoryContents
(System.String)¶ Enumerate a directory at the given path, if any.
Arguments: subpath (System.String) – The path that identifies the directory Return type: Microsoft.Extensions.FileProviders.IDirectoryContents Returns: Contents of the directory. Caller must check Exists property. The content is a merge of the contents of the provided Microsoft.Extensions.FileProviders.IFileProvider
. When there is multipleMicrosoft.Extensions.FileProviders.IFileInfo
with the same Name property, only the first one is included on the results.public IDirectoryContents GetDirectoryContents(string subpath)
-
GetFileInfo
(System.String)¶ Locates a file at the given path.
Arguments: subpath (System.String) – The path that identifies the file. Return type: Microsoft.Extensions.FileProviders.IFileInfo Returns: The file information. Caller must check Exists property. This will be the first existing Microsoft.Extensions.FileProviders.IFileInfo
returned by the providedMicrosoft.Extensions.FileProviders.IFileProvider
or a not foundMicrosoft.Extensions.FileProviders.IFileInfo
if no existing files is found.public IFileInfo GetFileInfo(string subpath)
-
Watch
(System.String)¶ Creates a
Microsoft.Extensions.Primitives.IChangeToken
for the specified <em>pattern</em>.Arguments: pattern (System.String) – Filter string used to determine what files or folders to monitor. Example: /*.cs, *.*, subFolder//*.cshtml. Return type: Microsoft.Extensions.Primitives.IChangeToken Returns: An Microsoft.Extensions.Primitives.IChangeToken
that is notified when a file matching <em>pattern</em> is added, modified or deleted. The change token will be notified when one of the change token returned by the providedMicrosoft.Extensions.FileProviders.IFileProvider
will be notified.public IChangeToken Watch(string pattern)
-