/// <summary> /// Removes the first occurrence of a specific object from the <see cref="DistinguishedNameList"/>. /// </summary> /// <param name="value">The <see cref="DistinguishedName"/> to remove from the DistinguishedNameList.</param> /// <exception cref="ArgumentNullException"><paramref name="value"/> is a null reference (<b>Nothing</b> in Visual Basic).</exception> /// <exception cref="NotSupportedException">The DistinguishedNameList is read-only -or- the DistinguishedNameList has a fixed size.</exception> public void Remove(DistinguishedName value) { m_List.Remove(value); }
/// <summary> /// Inserts an element into the <see cref="DistinguishedNameList"/> at the specified index. /// </summary> /// <param name="index">The zero-based index at which <paramref name="value"/> should be inserted.</param> /// <param name="value">The <see cref="DistinguishedName"/> to insert. </param> /// <exception cref="ArgumentNullException"><paramref name="value"/> is a null reference (<b>Nothing</b> in Visual Basic).</exception> /// <exception cref="ArgumentOutOfRangeException"><paramref name="index"/> is less than zero -or- <paramref name="index"/> is greater than <see cref="Count"/>.</exception> /// <exception cref="NotSupportedException">The DistinguishedNameList is read-only -or- the DistinguishedNameList has a fixed size.</exception> public void Insert(int index, DistinguishedName value) { if (value == null) throw new ArgumentNullException(); m_List.Insert(index, value); }
/// <summary> /// Searches for the specified <see cref="DistinguishedName"/> and returns the zero-based index of the first occurrence within the entire <see cref="DistinguishedNameList"/>. /// </summary> /// <param name="value">The DistinguishedName to locate in the DistinguishedNameList.</param> /// <returns>The zero-based index of the first occurrence of value within the entire DistinguishedNameList, if found; otherwise, -1.</returns> /// <exception cref="ArgumentNullException"><paramref name="value"/> is a null reference (<b>Nothing</b> in Visual Basic).</exception> public int IndexOf(DistinguishedName value) { if (value == null) throw new ArgumentNullException(); return m_List.IndexOf(value); }
/// <summary> /// Determines whether an element is in the <see cref="DistinguishedNameList"/>. /// </summary> /// <param name="value">The Object to locate in the DistinguishedNameList. The element to locate cannot be a null reference (<b>Nothing</b> in Visual Basic).</param> /// <returns><b>true</b> if item is found in the DistinguishedNameList; otherwise, <b>false</b>.</returns> /// <exception cref="ArgumentNullException"><paramref name="value"/> is a null reference (<b>Nothing</b> in Visual Basic).</exception> public bool Contains(DistinguishedName value) { if (value == null) throw new ArgumentNullException(); return m_List.Contains(value); }
/// <summary> /// returns true, if all nameattributes of name are part fo otherName /// </summary> private bool IsNamePartOfOtherName(DistinguishedName name, DistinguishedName otherName) { for (int i = 0; i < name.Count; i++) { if (!otherName.Contains(name[i])) { return false; } } return true; }
private bool IsDistinguishedNameInList(DistinguishedName searchFor, DistinguishedNameList acceptable) { foreach (DistinguishedName acceptableName in acceptable) { if (IsNamePartOfOtherName(searchFor, acceptableName)) { return true; } } return false; }