/// <summary>
/// Constructs an LdapSearchConstraints object initialized with values
/// from an existing constraints object (LdapConstraints
/// or LdapSearchConstraints).
/// </summary>
public LdapSearchConstraints(LdapConstraints cons)
: base(cons.TimeLimit, cons.ReferralFollowing, cons.getReferralHandler(), cons.HopLimit)
{
var lsc = cons.GetControls();
if (lsc != null)
{
var generatedVar = new LdapControl[lsc.Length];
lsc.CopyTo(generatedVar, 0);
SetControls(generatedVar);
}
var lp = cons.Properties;
if (lp != null)
{
Properties = (Hashtable)lp.Clone();
}
if (cons is LdapSearchConstraints)
{
var scons = (LdapSearchConstraints)cons;
ServerTimeLimit = scons.ServerTimeLimit;
Dereference = scons.Dereference;
MaxResults = scons.MaxResults;
BatchSize = scons.BatchSize;
}
}