ContextFactory.GetPrincipalContext C# (CSharp) Method

GetPrincipalContext() public method

public GetPrincipalContext ( ContextType contextType, string domainName ) : PrincipalContext
contextType ContextType
domainName string
return PrincipalContext
           public PrincipalContext GetPrincipalContext(ContextType contextType, string domainName)
           {
               PrincipalContext existingContext = contexts.First(item=>item.ContextType==contextType && 
                  item.DomainName == domainName);
               if (existingContext == null) {
                   existingContext = new PrincipalContext(contextType,domainName);
                   contexts.Add(existingContext);
               }
               return(existingContext);
            }
        }
ContextFactory