Bamboo.Prevalence.XPath.XPathObjectNavigator.SelectObjects C# (CSharp) Метод

SelectObjects() публичный Метод

Selects a group of objects from the current node.
public SelectObjects ( string xpath, Type returnItemType ) : Array
xpath string selection expression
returnItemType System.Type array element type to be returned
Результат System.Array
		public System.Array SelectObjects(string xpath, Type returnItemType)
		{			
			if (null == returnItemType)
			{
				throw new ArgumentNullException("returnItemType");
			}

			System.Collections.ArrayList result = new System.Collections.ArrayList();
			XPathNodeIterator i = Select(xpath);
			while (i.MoveNext())
			{
				result.Add(((XPathObjectNavigator)i.Current).Node);
			}
			return result.ToArray(returnItemType);
		}

Same methods

XPathObjectNavigator::SelectObjects ( string xpath ) : object[]

Usage Example

		public void TestSelectObjects()
		{
			Address address = new Address("Strawberry Street", 45);
			Customer customer1 = new Customer("Rodrigo", "Oliveira", address);
			Customer customer2 = new Customer("Marcia", "Longo", address);

			Customer[] customers = { customer1, customer2 };
			XPathObjectNavigator navigator = new XPathObjectNavigator(customers);
			object[] actual = navigator.SelectObjects("Customer[Address/Number = 45]");
			AssertEquals(2, actual.Length);
			AssertEquals(customer1, actual[0]);
			AssertEquals(customer2, actual[1]);
		}