Inheritance: IAsn1Convertible
        /**
         * @param explicitly true if an explicitly tagged object.
         * @param tagNo the tag number for this object.
         * @param obj the tagged object.
         */
        public BerTaggedObject(
			bool			explicitly,
			int				tagNo,
			Asn1Encodable	obj)
            : base(explicitly, tagNo, obj)
        {
        }
 /**
  * @param tagNo the tag number for this object.
  * @param obj the tagged object.
  */
 protected Asn1TaggedObject(
     int             tagNo,
     Asn1Encodable   obj)
 {
     this.explicitly = true;
     this.tagNo = tagNo;
     this.obj = obj;
 }
 /**
  * @param explicitly true if the object is explicitly tagged.
  * @param tagNo the tag number for this object.
  * @param obj the tagged object.
  */
 protected Asn1TaggedObject(
     bool            explicitly,
     int             tagNo,
     Asn1Encodable   obj)
 {
     // IAsn1Choice marker interface 'insists' on explicit tagging
     this.explicitly = explicitly || (obj is IAsn1Choice);
     this.tagNo = tagNo;
     this.obj = obj;
 }
        public virtual void WriteObject(
			Asn1Encodable obj)
        {
            if (obj == null)
            {
                WriteNull();
            }
            else
            {
                obj.ToAsn1Object().Encode(this);
            }
        }
        public DerApplicationSpecific(
			bool			isExplicit,
			int				tag,
			Asn1Encodable	obj)
        {
            byte[] data = obj.GetDerEncoded();

            this.isConstructed = isExplicit;
            this.tag = tag;

            if (isExplicit)
            {
                this.octets = data;
            }
            else
            {
                int lenBytes = GetLengthOfLength(data);
                byte[] tmp = new byte[data.Length - lenBytes];
                Array.Copy(data, lenBytes, tmp, 0, tmp.Length);
                this.octets = tmp;
            }
        }
        /**
         * @param tagNo the tag number for this object.
         * @param obj the tagged object.
         */
        public BerTaggedObject(
			int				tagNo,
			Asn1Encodable	obj)
            : base(tagNo, obj)
        {
        }
        public BerOctetString(
			Asn1Encodable obj)
            : base(obj.ToAsn1Object())
        {
        }
        /**
         * @param obj - a single object that makes up the set.
         */
        public DerSet(
			Asn1Encodable obj)
            : base(1)
        {
            AddObject(obj);
        }
 protected internal void AddObject(
     Asn1Encodable obj)
 {
     seq.Add(obj);
 }
 private static void WriteEncodable(MemoryStream ms, Asn1Encodable e)
 {
     if (e != null)
     {
         byte[] bs = e.GetDerEncoded();
         ms.Write(bs, 0, bs.Length);
     }
 }
 public virtual Asn1Encodable[] ToArray()
 {
     Asn1Encodable[] values = new Asn1Encodable[this.Count];
     for (int i = 0; i < this.Count; ++i)
     {
         values[i] = this[i];
     }
     return values;
 }
        public DerApplicationSpecific(
			int				tag, 
			Asn1Encodable	obj)
            : this(true, tag, obj)
        {
        }
        public DerBitString(
			Asn1Encodable obj)
        {
            this.data = obj.GetDerEncoded();
            //this.padBits = 0;
        }
 public BerOctetString(
     Asn1Encodable obj)
     : base(obj.ToAsn1Object())
 {
 }