Equals

BaseSlide.Equals 方法

确定两者 IBaseSlide 实例是否相等。返回值是基于幻灯片的结构和静态内容计算得出的。如果所有形状、样式、文本、动画及其他设置等都相等,则两个幻灯片是相等的。比较不考虑唯一标识符值,例如 SlideId 和动态内容,例如 Date Placeholder 中的当前日期值。

public bool Equals(IBaseSlide slide)
参数类型描述
slideIBaseSlide要与当前 IBaseSlide 进行比较的 IBaseSlide。

返回值

true 如果指定的 IBaseSlide 等于当前 IBaseSlide;否则,false

示例

以下示例展示了如何比较两个幻灯片。

[C#]
using (Presentation presentation1 = new Presentation("AccessSlides.pptx"))
{
	using (Presentation presentation2 = new Presentation("HelloWorld.pptx"))
	{
		for (int i = 0; i < presentation1.Masters.Count; i++)
		{
			for (int j = 0; j < presentation2.Masters.Count; j++)
			{
				if (presentation1.Masters[i].Equals(presentation2.Masters[j]))
					Console.WriteLine(string.Format("SomePresentation1 MasterSlide#{0} 是等于 SomePresentation2 MasterSlide#{1}", i, j));
			}
		}
	}
}

另请参见