【发布时间】:2026-02-23 13:10:02
【问题描述】:
在下面的代码块中有几个按位或。我以前从未使用过它们,所以我试图理解代码块的含义。
Document doc = new Document("CleanupOptions.docx");
doc.MailMerge.CleanupOptions = MailMergeCleanupOptions.RemoveUnusedRegions |
MailMergeCleanupOptions.RemoveUnusedFields |
MailMergeCleanupOptions.RemoveContainingFields;
doc.MailMerge.ExecuteWithRegions(dataSet);
所以在上面的那个块中,如果我使用 doc.MailMerge.CleanupOptions,我将如何选择 CleanupOptions 等于的任何语句?还是它们都结合在一起了?
【问题讨论】:
-
这个 Q/A 很好地解释了带有 [Flags] 的枚举:*.com/questions/8447/…
-
关于flags
-
假设
CleanupOptions是一个位域枚举,这只是连接常量...
标签: c# bitwise-operators aspose.words bitwise-or