本文整理匯總了C#中libsbml.XMLAttributes.getIndex方法的典型用法代碼示例。如果您正苦於以下問題:C# XMLAttributes.getIndex方法的具體用法?C# XMLAttributes.getIndex怎麽用?C# XMLAttributes.getIndex使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類libsbml.XMLAttributes
的用法示例。
在下文中一共展示了XMLAttributes.getIndex方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: test_XMLAttributes_add_get
public void test_XMLAttributes_add_get()
{
XMLAttributes attrs = new XMLAttributes();
assertTrue( attrs.getLength() == 0 );
assertEquals( true, attrs.isEmpty() );
attrs.add("xmlns", "http://foo.org/");
assertTrue( attrs.getLength() == 1 );
assertTrue( attrs.isEmpty() == false );
attrs.add("foo", "bar");
assertTrue( attrs.getLength() == 2 );
assertTrue( attrs.isEmpty() == false );
assertTrue( attrs.getIndex("xmlns") == 0 );
assertTrue( attrs.getIndex("foo" ) == 1 );
assertTrue( attrs.getIndex("bar" ) == -1 );
assertTrue( attrs.getValue("xmlns") == "http://foo.org/" );
assertTrue( attrs.getValue("foo" ) == "bar" );
assertTrue( attrs.getValue("bar" ) == "" );
assertTrue( attrs.getName(0) == "xmlns" );
assertTrue( attrs.getName(1) == "foo" );
assertTrue( attrs.getName(2) == "" );
}
示例2: test_XMLAttributes_assignment
public void test_XMLAttributes_assignment()
{
XMLAttributes att1 = new XMLAttributes();
att1.add("xmlns", "http://foo.org/");
assertTrue( att1.getLength() == 1 );
assertTrue( att1.isEmpty() == false );
assertTrue( att1.getIndex("xmlns") == 0 );
assertTrue( att1.getName(0) == "xmlns" );
assertTrue( att1.getValue("xmlns") == "http://foo.org/" );
XMLAttributes att2 = new XMLAttributes();
att2 = att1;
assertTrue( att2.getLength() == 1 );
assertTrue( att2.isEmpty() == false );
assertTrue( att2.getIndex("xmlns") == 0 );
assertTrue( att2.getName(0) == "xmlns" );
assertTrue( att2.getValue("xmlns") == "http://foo.org/" );
att2 = null;
att1 = null;
}