Exemple #1
0
 /// <summary>
 /// Removes elements up to and including the specified index.
 /// </summary>
 void RemoveParentElements(int index)
 {
     while (index >= 0)
     {
         --index;
         elements.RemoveFirst();
     }
 }
 /// <summary>
 /// Compacts the path so it only contains the elements that are from
 /// the namespace of the last element in the path.
 /// </summary>
 /// <remarks>This method is used when we need to know the path for a
 /// particular namespace and do not care about the complete path.
 /// </remarks>
 public void Compact()
 {
     if (elements.HasItems)
     {
         QualifiedName lastName = Elements.GetLast();
         int           index    = LastIndexNotMatchingNamespace(lastName.Namespace);
         if (index != -1)
         {
             elements.RemoveFirst(index + 1);
         }
     }
 }
 public void RemoveFirstItemFromEmptyCollectionDoesNotThrowArgumentOutOfRangeException()
 {
     qualifiedNameCollection = new QualifiedNameCollection();
     Assert.DoesNotThrow(delegate { qualifiedNameCollection.RemoveFirst(); });
 }