PrincipalCollection.Contains Метод

Определение

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

Перегрузки

Имя Описание
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
Исходный код:
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
Исходный код:
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
Исходный код:
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
Исходный код:
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
Исходный код:
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если объект, соответствующий/identityValuefalseпаре, находится в коллекции; в противном случае .

Атрибуты

Комментарии

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

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

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