本文整理汇总了C#中HashSet2.RetainAll方法的典型用法代码示例。如果您正苦于以下问题:C# HashSet2.RetainAll方法的具体用法?C# HashSet2.RetainAll怎么用?C# HashSet2.RetainAll使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HashSet2
的用法示例。
在下文中一共展示了HashSet2.RetainAll方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CheckLayer
protected override void CheckLayer(PdfWriter writer, int key, Object obj1) {
if (obj1 is IPdfOCG) {
} else if (obj1 is PdfOCProperties) {
PdfOCProperties properties = (PdfOCProperties)obj1;
List<PdfDictionary> configsList = new List<PdfDictionary>();
PdfDictionary d = GetDirectDictionary(properties.Get(PdfName.D));
if (d != null)
configsList.Add(d);
PdfArray configs = GetDirectArray(properties.Get(PdfName.CONFIGS));
if (configs != null) {
for (int i = 0; i < configs.Size; i++) {
PdfDictionary config = GetDirectDictionary(configs[i]);
if (config != null)
configsList.Add(config);
}
}
HashSet2<PdfObject> ocgs = new HashSet2<PdfObject>();
PdfArray ocgsArray = GetDirectArray(properties.Get(PdfName.OCGS));
if (ocgsArray != null)
for (int i = 0; i < ocgsArray.Size; i++)
ocgs.Add(ocgsArray[i]);
HashSet2<String> names = new HashSet2<String>();
HashSet2<PdfObject> order = new HashSet2<PdfObject>();
foreach (PdfDictionary config in configsList) {
PdfString name = config.GetAsString(PdfName.NAME);
if (name == null) {
throw new PdfAConformanceException(MessageLocalization.GetComposedMessage("optional.content.configuration.dictionary.shall.contain.name.entry"));
}
String name1 = name.ToUnicodeString();
if (names.Contains(name1)) {
throw new PdfAConformanceException(MessageLocalization.GetComposedMessage("value.of.name.entry.shall.be.unique.amongst.all.optional.content.configuration.dictionaries"));
}
names.Add(name1);
if (config.Contains(PdfName.AS)) {
throw new PdfAConformanceException(MessageLocalization.GetComposedMessage("the.as.key.shall.not.appear.in.any.optional.content.configuration.dictionary"));
}
PdfArray orderArray = GetDirectArray(config.Get(PdfName.ORDER));
if (orderArray != null)
FillOrderRecursively(orderArray, order);
}
if (order.Count != ocgs.Count) {
throw new PdfAConformanceException(MessageLocalization.GetComposedMessage("order.array.shall.contain.references.to.all.ocgs"));
}
ocgs.RetainAll(order);
if (order.Count != ocgs.Count) {
throw new PdfAConformanceException(MessageLocalization.GetComposedMessage("order.array.shall.contain.references.to.all.ocgs"));
}
} else {
}
}