/// <summary>
        /// Creates a new ExtendedDnControl using the specified flag.
        /// </summary>
        /// <param name="flag">The format of the GUID that will be returned.</param>
        /// <param name="critical">True if the LDAP operation should be discarded if the
        /// control is not supported. False if the operation can be processed without
        /// the control.</param>
        public ExtendedDnControl(GuidFormatFlag flag, bool critical)
            : base(ExtendedDnControlOID, critical, null)
        {
            _controlValue.Add(new Asn1Integer((int)flag));

            try
            {
                using (var encodedData = new MemoryStream())
                {
                    _controlValue.Encode(_encoder, encodedData);
                    SetValue(encodedData.ToArray());
                }
            }
            catch (IOException e)
            {
                // Shouldn't occur unless there is a serious failure
                throw new InvalidOperationException("Unable to create instance of ExtendedDnControl", e);
            }
        }