PrincipalCollection.Contains Метод

Определение

Возвращает значение, указывающее, является ли указанный объект Principal членом объекта PrincipalCollection. Add указывается точно так же, как и в методах Principal.

Перегрузки

Contains(ComputerPrincipal)

Возвращает значение, указывающее, содержит ли коллекция указанный объект ComputerPrincipal.

Contains(GroupPrincipal)

Возвращает значение, указывающее, содержит ли коллекция указанный объект GroupPrincipal.

Contains(Principal)

Возвращает значение, указывающее, содержит ли коллекция указанный объект Principal.

Contains(UserPrincipal)

Возвращает значение, указывающее, содержит ли коллекция указанный объект UserPrincipal.

Contains(PrincipalContext, IdentityType, String)

Возвращает значение, указывающее, совпадает ли объект Principal с парой identityType/identityValue в этой коллекции.

Комментарии

Как и в случае с Add, существует Remove четыре перегрузки для этой функции, но все они делают то же самое. Дополнительные перегрузки реализуются только для повышения удобства использования, чтобы разработчики, использующие IntelliSense, видели перегрузки, которые принимают UserPrincipalобъект , GroupPrincipalили ComputerPrincipal . Вызов любой из перегрузок "Пользователь", "Группа" или "Компьютер" в точности эквивалентен вызову перегрузки Principal .

Contains(ComputerPrincipal)

Исходный код:
PrincipalCollection.cs
Исходный код:
PrincipalCollection.cs
Исходный код:
PrincipalCollection.cs

Возвращает значение, указывающее, содержит ли коллекция указанный объект ComputerPrincipal.

public:
 bool Contains(System::DirectoryServices::AccountManagement::ComputerPrincipal ^ computer);
public bool Contains (System.DirectoryServices.AccountManagement.ComputerPrincipal computer);
[System.Security.SecurityCritical]
public bool Contains (System.DirectoryServices.AccountManagement.ComputerPrincipal computer);
member this.Contains : System.DirectoryServices.AccountManagement.ComputerPrincipal -> bool
[<System.Security.SecurityCritical>]
member this.Contains : System.DirectoryServices.AccountManagement.ComputerPrincipal -> bool
Public Function Contains (computer As ComputerPrincipal) As Boolean

Параметры

computer
ComputerPrincipal

Объект ComputerPrincipal.

Возвращаемое значение

Значение true, если коллекция содержит указанный объект; в обратном случае — значение false.

Атрибуты

Применяется к

Contains(GroupPrincipal)

Исходный код:
PrincipalCollection.cs
Исходный код:
PrincipalCollection.cs
Исходный код:
PrincipalCollection.cs

Возвращает значение, указывающее, содержит ли коллекция указанный объект GroupPrincipal.

public:
 bool Contains(System::DirectoryServices::AccountManagement::GroupPrincipal ^ group);
public bool Contains (System.DirectoryServices.AccountManagement.GroupPrincipal group);
[System.Security.SecurityCritical]
public bool Contains (System.DirectoryServices.AccountManagement.GroupPrincipal group);
member this.Contains : System.DirectoryServices.AccountManagement.GroupPrincipal -> bool
[<System.Security.SecurityCritical>]
member this.Contains : System.DirectoryServices.AccountManagement.GroupPrincipal -> bool
Public Function Contains (group As GroupPrincipal) As Boolean

Параметры

group
GroupPrincipal

Объект GroupPrincipal.

Возвращаемое значение

Значение true, если коллекция содержит указанный объект; в обратном случае — значение false.

Атрибуты

Применяется к

Contains(Principal)

Исходный код:
PrincipalCollection.cs
Исходный код:
PrincipalCollection.cs
Исходный код:
PrincipalCollection.cs

Возвращает значение, указывающее, содержит ли коллекция указанный объект Principal.

public:
 virtual bool Contains(System::DirectoryServices::AccountManagement::Principal ^ principal);
public bool Contains (System.DirectoryServices.AccountManagement.Principal principal);
[System.Security.SecurityCritical]
public bool Contains (System.DirectoryServices.AccountManagement.Principal principal);
abstract member Contains : System.DirectoryServices.AccountManagement.Principal -> bool
override this.Contains : System.DirectoryServices.AccountManagement.Principal -> bool
[<System.Security.SecurityCritical>]
abstract member Contains : System.DirectoryServices.AccountManagement.Principal -> bool
override this.Contains : System.DirectoryServices.AccountManagement.Principal -> bool
Public Function Contains (principal As Principal) As Boolean

Параметры

principal
Principal

Объект Principal.

Возвращаемое значение

Значение true, если коллекция содержит указанный объект; в обратном случае — значение false.

Реализации

Атрибуты

Применяется к

Contains(UserPrincipal)

Исходный код:
PrincipalCollection.cs
Исходный код:
PrincipalCollection.cs
Исходный код:
PrincipalCollection.cs

Возвращает значение, указывающее, содержит ли коллекция указанный объект UserPrincipal.

public:
 bool Contains(System::DirectoryServices::AccountManagement::UserPrincipal ^ user);
public bool Contains (System.DirectoryServices.AccountManagement.UserPrincipal user);
[System.Security.SecurityCritical]
public bool Contains (System.DirectoryServices.AccountManagement.UserPrincipal user);
member this.Contains : System.DirectoryServices.AccountManagement.UserPrincipal -> bool
[<System.Security.SecurityCritical>]
member this.Contains : System.DirectoryServices.AccountManagement.UserPrincipal -> bool
Public Function Contains (user As UserPrincipal) As Boolean

Параметры

user
UserPrincipal

Объект UserPrincipal.

Возвращаемое значение

Значение true, если коллекция содержит указанный объект; в обратном случае — значение false.

Атрибуты

Применяется к

Contains(PrincipalContext, IdentityType, String)

Исходный код:
PrincipalCollection.cs
Исходный код:
PrincipalCollection.cs
Исходный код:
PrincipalCollection.cs

Возвращает значение, указывающее, совпадает ли объект Principal с парой identityType/identityValue в этой коллекции.

public:
 bool Contains(System::DirectoryServices::AccountManagement::PrincipalContext ^ context, System::DirectoryServices::AccountManagement::IdentityType identityType, System::String ^ identityValue);
public bool Contains (System.DirectoryServices.AccountManagement.PrincipalContext context, System.DirectoryServices.AccountManagement.IdentityType identityType, string identityValue);
[System.Security.SecurityCritical]
public bool Contains (System.DirectoryServices.AccountManagement.PrincipalContext context, System.DirectoryServices.AccountManagement.IdentityType identityType, string identityValue);
member this.Contains : System.DirectoryServices.AccountManagement.PrincipalContext * System.DirectoryServices.AccountManagement.IdentityType * string -> bool
[<System.Security.SecurityCritical>]
member this.Contains : System.DirectoryServices.AccountManagement.PrincipalContext * System.DirectoryServices.AccountManagement.IdentityType * string -> bool
Public Function Contains (context As PrincipalContext, identityType As IdentityType, identityValue As String) As Boolean

Параметры

context
PrincipalContext

Объект PrincipalContext участника.

identityType
IdentityType

Объект IdentityType , указывающий формат identityValue.

identityValue
String

Строка, идентифицирующая участника в формате, заданном параметром identityType.

Возвращаемое значение

Значение true если объект, соответствующий паре identityType/identityValue, находится в коллекции. В противном случае значение false.

Атрибуты

Комментарии

Эта функция может вызывать следующие исключения:

Исключение Описание
MultipleMatchesException Существует несколько субъектов, соответствующих этим параметрам.
ArgumentException Параметр identityType не может быть пустым.

Применяется к