IndexOf

IMathElementCollection.IndexOf method

确定集合中特定数学元素的索引。

public int IndexOf(IMathElement item)
参数类型描述
itemIMathElement要在集合中定位的元素。

返回值

如果在集合中找到 item 的索引;否则,返回 -1。

示例

示例:

[C#]
IMathElementCollection collection = new MathBlock(new MathematicalText("x"));
MathematicalText plusElement = new MathematicalText("+");
collection.Add(plusElement);
collection.Add(new MathRadical(new MathematicalText("x"), new MathematicalText("3")));
int index = collection.IndexOf(plusElement);

参见