Principal.IsMemberOf Method (GroupPrincipal)
Returns a Boolean value that specifies whether the principal is a member of the specified group.
Assembly: System.DirectoryServices.AccountManagement (in System.DirectoryServices.AccountManagement.dll)
The GroupPrincipal object for which principal membership is determined.
Return ValueType: System.Boolean
true if the principal is a member of the specified group; otherwise false.
If the current principal is an AD DS principal, the returned groups include the principal's primary group, as indicated by the primary group ID attribute on the AD DS object.
Available since 3.5