PresentationLockingBehavior

IBlobManagementOptions.PresentationLockingBehavior 属性

此属性定义了在实例生命周期内,Presentation 类的实例是否可以成为源文件或流的所有者。如果实例是所有者,它将锁定源。这有助于在处理 BLOB 时提高内存消耗和性能,但在 Presentation 的实例生命周期内,源(流或文件)不能更改。这是一个例子:

public PresentationLockingBehavior PresentationLockingBehavior { get; set; }

示例

LoadOptions loadOptions = new LoadOptions { 
  BlobManagementOptions = {PresentationLockingBehavior = PresentationLockingBehavior.KeepLocked} };
using (Presentation pres = new Presentation("pres.pptx", loadOptions)) {
  // IOException 将被抛出,因为 pres.pptx 在 Presentation 生命周期内被锁定
  // File.Delete("pres.pptx");
}
// 在 Presentation 对象释放后,文件被解锁并可以被删除
File.Delete("pres.pptx");

另见