PrincipalCollection.Contains Metoda
Definicja
Zwraca wartość wskazującą, czy określony Principal element jest członkiem PrincipalCollection .Returns a value that indicates whether the specified Principal is a member of the PrincipalCollection. PrincipalMożna określić w taki sam sposób jak w Add metodach.The Principal can be specified in the same manner as in the Add methods.
Przeciążenia
Contains(ComputerPrincipal) |
Zwraca wartość wskazującą czy kolekcja zawiera określony ComputerPrincipal obiekt.Returns a value indicating whether the collection contains the specified ComputerPrincipal object. |
Contains(GroupPrincipal) |
Zwraca wartość wskazującą czy kolekcja zawiera określony GroupPrincipal obiekt.Returns a value indicating whether the collection contains the specified GroupPrincipal object. |
Contains(Principal) |
Zwraca wartość wskazującą czy kolekcja zawiera określony Principal obiekt.Returns a value indicating whether the collection contains the specified Principal object. |
Contains(UserPrincipal) |
Zwraca wartość wskazującą czy kolekcja zawiera określony UserPrincipal obiekt.Returns a value indicating whether the collection contains the specified UserPrincipal object. |
Contains(PrincipalContext, IdentityType, String) |
Zwraca wartość wskazującą Principal , czy obiekt pasujący do |
Uwagi
Podobnie jak w przypadku programu Add i istnieją Remove cztery przeciążenia tej funkcji, ale wszystkie te czynności wykonują tę samą czynność.As with Add, and Remove there are four overloads to this function, but they all do the same thing. Dodatkowe przeciążenia są implementowane tylko w celu zwiększenia użyteczności, dzięki czemu deweloperzy korzystający z technologii IntelliSense zobaczą przeciążenia przyjmujące UserPrincipal GroupPrincipal obiekt, lub ComputerPrincipal .The extra overloads are only implemented to improve usability, so that developers using IntelliSense see overloads that take a UserPrincipal, GroupPrincipal, or ComputerPrincipal object. Wywołanie jednego z przeciążeń użytkownika, grupy lub komputera jest dokładnie równoważne do wywołania Principal przeciążenia.Calling any one of the User, Group, or Computer overloads is exactly equivalent to calling the Principal overload.
Contains(ComputerPrincipal)
Zwraca wartość wskazującą czy kolekcja zawiera określony ComputerPrincipal obiekt.Returns a value indicating whether the collection contains the specified ComputerPrincipal object.
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
Parametry
- computer
- ComputerPrincipal
Obiekt ComputerPrincipal.A ComputerPrincipal object.
Zwraca
true
Jeśli kolekcja zawiera określony obiekt; w przeciwnym razie false
.true
if the collection contains the specified object; otherwise, false
.
- Atrybuty
Dotyczy
Contains(GroupPrincipal)
Zwraca wartość wskazującą czy kolekcja zawiera określony GroupPrincipal obiekt.Returns a value indicating whether the collection contains the specified GroupPrincipal object.
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
Parametry
- group
- GroupPrincipal
GroupPrincipalObiektA GroupPrincipal object
Zwraca
true
Jeśli kolekcja zawiera określony obiekt; w przeciwnym razie false
.true
if the collection contains the specified object; otherwise, false
.
- Atrybuty
Dotyczy
Contains(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
Parametry
Zwraca
true
Jeśli kolekcja zawiera określony obiekt; w przeciwnym razie false
.true
if the collection contains the specified object; otherwise, false
.
Implementuje
- Atrybuty
Dotyczy
Contains(UserPrincipal)
Zwraca wartość wskazującą czy kolekcja zawiera określony UserPrincipal obiekt.Returns a value indicating whether the collection contains the specified UserPrincipal object.
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
Parametry
- user
- UserPrincipal
Obiekt UserPrincipal.A UserPrincipal object.
Zwraca
true
Jeśli kolekcja zawiera określony obiekt; w przeciwnym razie false
.true
if the collection contains the specified object; otherwise, false
.
- Atrybuty
Dotyczy
Contains(PrincipalContext, IdentityType, String)
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
Parametry
- context
- PrincipalContext
PrincipalContextObiekt podmiotu zabezpieczeń.The PrincipalContext object of the principal.
- identityType
- IdentityType
IdentityTypeObiekt, który określa formatidentityValue
An IdentityType object that specifies the format of identityValue
- identityValue
- String
Ciąg, który identyfikuje podmiot zabezpieczeń w formacie określonym przez identityType
A string that identifies the principal, in the format specified by identityType
Zwraca
true
Jeśli obiekt pasujący do identityType
/ identityValue
pary znajduje się w kolekcji; w przeciwnym razie false
.true
if an object matching the identityType
/identityValue
pair is in the collection; otherwise, false
.
- Atrybuty
Uwagi
Ta funkcja może zgłosić następujące wyjątki:This function can throw the following exceptions:
WyjątekException | OpisDescription |
---|---|
MultipleMatchesException | Istnieje wiele podmiotów, które pasują do tych parametrów.There are multiple principals matching these parameters. |
ArgumentException | identityType Parametr nie może być pusty.The identityType parameter cannot be empty. |