GetInstance() public static method

public static GetInstance ( object obj ) : Attribute
obj object
return Attribute
        public AttributeTable(
            Asn1EncodableVector v)
        {
            this.attributes = Platform.CreateHashtable(v.Count);

            foreach (Asn1Encodable o in v)
            {
                Attribute a = Attribute.GetInstance(o);

                AddAttribute(a);
            }
        }
        public AttributeTable(
            Asn1Set s)
        {
            this.attributes = new Hashtable(s.Count);

            for (int i = 0; i != s.Count; i++)
            {
                Attribute a = Attribute.GetInstance(s[i]);

                AddAttribute(a);
            }
        }
        public Asn1EncodableVector ToAsn1EncodableVector()
        {
            Asn1EncodableVector asn1EncodableVector = new Asn1EncodableVector();

            global::System.Collections.IEnumerator enumerator = ((global::System.Collections.IEnumerable)attributes.get_Values()).GetEnumerator();
            try
            {
                while (enumerator.MoveNext())
                {
                    object current = enumerator.get_Current();
                    if (current is global::System.Collections.IList)
                    {
                        {
                            global::System.Collections.IEnumerator enumerator2 = ((global::System.Collections.IEnumerable)(global::System.Collections.IList) current).GetEnumerator();
                            try
                            {
                                while (enumerator2.MoveNext())
                                {
                                    object current2 = enumerator2.get_Current();
                                    asn1EncodableVector.Add(Attribute.GetInstance(current2));
                                }
                            }
                            finally
                            {
                                global::System.IDisposable disposable2 = enumerator2 as global::System.IDisposable;
                                if (disposable2 != null)
                                {
                                    disposable2.Dispose();
                                }
                            }
                        }
                    }
                    else
                    {
                        asn1EncodableVector.Add(Attribute.GetInstance(current));
                    }
                }
                return(asn1EncodableVector);
            }
            finally
            {
                global::System.IDisposable disposable = enumerator as global::System.IDisposable;
                if (disposable != null)
                {
                    disposable.Dispose();
                }
            }
        }
Beispiel #4
0
        public Asn1EncodableVector ToAsn1EncodableVector()
        {
            Asn1EncodableVector v = new Asn1EncodableVector();

            foreach (object obj in attributes.Values)
            {
                if (obj is IList)
                {
                    foreach (object el in (IList)obj)
                    {
                        v.Add(Attribute.GetInstance(el));
                    }
                }
                else
                {
                    v.Add(Attribute.GetInstance(obj));
                }
            }

            return(v);
        }
 public AttributeTable(Asn1EncodableVector v)
 {
     attributes = Platform.CreateHashtable(v.Count);
     global::System.Collections.IEnumerator enumerator = v.GetEnumerator();
     try
     {
         while (enumerator.MoveNext())
         {
             Asn1Encodable obj      = (Asn1Encodable)enumerator.get_Current();
             Attribute     instance = Attribute.GetInstance(obj);
             AddAttribute(instance);
         }
     }
     finally
     {
         global::System.IDisposable disposable = enumerator as global::System.IDisposable;
         if (disposable != null)
         {
             disposable.Dispose();
         }
     }
 }