EmbeddedFileProvider Class

Looks up files using embedded resources in the specified assembly. This file provider is case sensitive.

Namespace
Microsoft.Extensions.FileProviders
Assemblies
  • Microsoft.Extensions.FileProviders.Embedded

Syntax

public class EmbeddedFileProvider : IFileProvider
class Microsoft.Extensions.FileProviders.EmbeddedFileProvider

Constructors

EmbeddedFileProvider(System.Reflection.Assembly)

Initializes a new instance of the Microsoft.Extensions.FileProviders.EmbeddedFileProvider class using the specified assembly and empty base namespace.

public EmbeddedFileProvider(Assembly assembly)
EmbeddedFileProvider(System.Reflection.Assembly, System.String)

Initializes a new instance of the Microsoft.Extensions.FileProviders.EmbeddedFileProvider class using the specified assembly and base namespace.

Arguments:
  • assembly (System.Reflection.Assembly) – The assembly that contains the embedded resources.
  • baseNamespace (System.String) – The base namespace that contains the embedded resources.
public EmbeddedFileProvider(Assembly assembly, string baseNamespace)

Methods

GetDirectoryContents(System.String)

Enumerate a directory at the given path, if any. This file provider uses a flat directory structure. Everything under the base namespace is considered to be one directory.

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.
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.
public IFileInfo GetFileInfo(string subpath)
Watch(System.String)
Return type:Microsoft.Extensions.Primitives.IChangeToken
public IChangeToken Watch(string pattern)