This documentation is archived and is not being maintained.

Assembly.GetFile Method

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

Namespace: System.Reflection
Assembly: mscorlib (in mscorlib.dll)

public virtual FileStream GetFile (
	string name
)
public FileStream GetFile (
	String name
)
public function GetFile (
	name : String
) : FileStream

Parameters

name

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

Return Value

A FileStream for the specified file, or a null reference (Nothing in Visual Basic) if the file is not found.

Exception typeCondition

FileLoadException

A file that was found could not be loaded.

ArgumentNullException

The name parameter is a null reference (Nothing in Visual Basic).

ArgumentException

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

FileNotFoundException

name was not found.

BadImageFormatException

name is not a valid assembly.

This method works on both public and private resource files.

The name should not include the path to the file.

Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Framework

Supported in: 2.0, 1.1, 1.0
Show: