Uređivanje

Dijeli putem


Assembly.GetFile(String) Method

Definition

Gets a FileStream for the specified file in the file table of the manifest of this assembly.

public:
 virtual System::IO::FileStream ^ GetFile(System::String ^ name);
public virtual System.IO.FileStream? GetFile (string name);
public virtual System.IO.FileStream GetFile (string name);
abstract member GetFile : string -> System.IO.FileStream
override this.GetFile : string -> System.IO.FileStream
Public Overridable Function GetFile (name As String) As FileStream

Parameters

name
String

The name of the specified file. Do not include the path to the file.

Returns

A stream that contains the specified file, or null if the file is not found.

Implements

Exceptions

A file that was found could not be loaded.

The name parameter is null.

The name parameter is an empty string ("").

name was not found.

name is not a valid assembly.

Remarks

This method works on both public and private resource files.

The name argument should not include the path to the file.

In .NET 5 and later versions, for bundled assemblies, this method throws an exception.

Applies to