Assembly.GetFile(String) Assembly.GetFile(String) Assembly.GetFile(String) Assembly.GetFile(String) Method

定义

获取此程序集清单的文件表中指定文件的 FileStreamGets 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);
abstract member GetFile : string -> System.IO.FileStream
override this.GetFile : string -> System.IO.FileStream
Public Overridable Function GetFile (name As String) As FileStream

参数

name
String String String String

指定文件的名称。The name of the specified file. 不包括文件的路径。Do not include the path to the file.

返回

包含指定文件的流,如果找不到文件则为 nullA stream that contains the specified file, or null if the file is not found.

实现

异常

无法加载已找到的文件。A file that was found could not be loaded.

name 参数为空字符串 ("")。The name parameter is an empty string ("").

name 不是有效的程序集。name is not a valid assembly.

注解

此方法适用于公用和专用资源文件。This method works on both public and private resource files.

name应包含文件的路径。The name should not include the path to the file.

安全性

FileIOPermission
用于访问路径和读取指定的文件。for access to the path and for reading the specified file. 关联的枚举PathDiscovery : 和ReadAssociated enumerations: PathDiscovery and Read

适用于