IPersistFile 接口


提供具有 IPersistFile 中的功能的 IPersist 接口的托管定义。Provides the managed definition of the IPersistFile interface, with functionality from IPersist.

public interface class IPersistFile
public interface IPersistFile
type IPersistFile = interface
Public Interface IPersistFile


有关详细信息,请参阅 MSDN library 中的 IPersistFileIPersist 的现有文档。For more information, see the existing documentation for IPersistFile and IPersist in the MSDN library.

当本机代码中的 COM 方法返回 HRESULT 时,公共语言运行时将引发异常。The common language runtime throws an exception when a COM method in native code returns an HRESULT. 有关更多信息,请参见 How to: Map HRESULTs and ExceptionsFor more information, see How to: Map HRESULTs and Exceptions.



检索对象的类标识符 (CLSID)。Retrieves the class identifier (CLSID) of an object.


检索该对象的当前工作文件的绝对路径,或者,如果没有当前工作文件,则检索该对象的默认文件名提示。Retrieves either the absolute path to the current working file of the object or, if there is no current working file, the default file name prompt of the object.


检查对象自上次保存到其当前文件以来是否更改。Checks an object for changes since it was last saved to its current file.

Load(String, Int32)

打开指定文件并从文件内容初始化对象。Opens the specified file and initializes an object from the file contents.

Save(String, Boolean)

将该对象的副本保存到指定文件。Saves a copy of the object into the specified file.


通知该对象它可以写入它的文件。Notifies the object that it can write to its file.