The following code sample outlines a method for determining the group membership of a Windows user using the WindowsIdentity class. This method attempts to be as quick as possible by only comparing the Group SID and not resolving the details for each group a user belongs to.