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
Not applicable.



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


A file that was found could not be loaded.


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


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


name was not found.


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 Server 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 Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0, 1.1, 1.0