IndexOf

MathBlock.IndexOf 方法

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

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

返回值

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

示例

示例:

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

另请参见