PropertyValueCollection.Remove(Object) 메서드

정의

이 컬렉션에서 지정된 속성 값을 제거합니다.

public:
 void Remove(System::Object ^ value);
public void Remove(object? value);
public void Remove(object value);
member this.Remove : obj -> unit
Public Sub Remove (value As Object)

매개 변수

value
Object

제거할 속성 값입니다.

예외

속성 값은 null 참조(Visual Basic Nothing)입니다.

기본 인터페이스를 호출하는 동안 오류가 발생했습니다.

예제

// Bind to the AD object
DirectoryEntry myUser = new DirectoryEntry("LDAP://AdServer:389/CN=MyUsername,CN=Users,DC=contoso,DC=com");

// Get the attribute
PropertyValueCollection testAttribute = myUser.Properties["someAttribute"];

// Find the item in the collection that we want to delete
DNWithString dnwsItemToRemove = null;
foreach (DNWithString dnwsItem in testAttribute)
{
    if (dnwsItem.StringValue.Equals("SomeValue"))
    {
        dnwsItemToRemove = dnwsItem;
        break;
    }
}

// Delete it
testAttribute.Remove(dnwsItemToRemove);

// Store the data
myUser.CommitChanges();

설명

다중값 문자열 속성 값으로 작업할 때 메서드는 Remove 올바른 항목을 성공적으로 제거합니다. 그러나 이름으로 올바른 항목을 식별하는 것은 다중값 DNWithString 속성 값(DNWithString 항목을 저장하는 데 사용되는 DNWithString COM 클래스에는 항목을 나타내는 2개의 문자열 속성이 있음)으로 인해 어렵습니다. 이러한 항목을 제거하는 방법은 컬렉션에서 개체를 찾은 다음(모든 항목을 반복하여) 방금 찾은 개체의 포인터를 사용하여 함수를 호출 Remove 하는 것입니다. 아래 예제에 나와 있습니다.

적용 대상