mscorlib(4.0.0.0) API with additions
OidCollection.cs
1 using System.Collections;
3 
5 {
7  public sealed class OidCollection : ICollection, IEnumerable
8  {
9  private ArrayList m_list;
10 
14  public Oid this[int index]
15  {
16  get
17  {
18  return m_list[index] as Oid;
19  }
20  }
21 
25  public Oid this[string oid]
26  {
27  get
28  {
29  string text = System.Security.Cryptography.X509Certificates.X509Utils.FindOidInfoWithFallback(2u, oid, OidGroup.All);
30  if (text == null)
31  {
32  text = oid;
33  }
34  foreach (Oid item in m_list)
35  {
36  if (item.Value == text)
37  {
38  return item;
39  }
40  }
41  return null;
42  }
43  }
44 
47  public int Count => m_list.Count;
48 
52  public bool IsSynchronized => false;
53 
56  public object SyncRoot => this;
57 
59  public OidCollection()
60  {
61  m_list = new ArrayList();
62  }
63 
67  public int Add(Oid oid)
68  {
69  return m_list.Add(oid);
70  }
71 
75  {
76  return new OidEnumerator(this);
77  }
78 
82  {
83  return new OidEnumerator(this);
84  }
85 
95  void ICollection.CopyTo(Array array, int index)
96  {
97  if (array == null)
98  {
99  throw new ArgumentNullException("array");
100  }
101  if (array.Rank != 1)
102  {
103  throw new ArgumentException(SR.GetString("Arg_RankMultiDimNotSupported"));
104  }
105  if (index < 0 || index >= array.Length)
106  {
107  throw new ArgumentOutOfRangeException("index", SR.GetString("ArgumentOutOfRange_Index"));
108  }
109  if (index + Count > array.Length)
110  {
111  throw new ArgumentException(SR.GetString("Argument_InvalidOffLen"));
112  }
113  for (int i = 0; i < Count; i++)
114  {
115  array.SetValue(this[i], index);
116  index++;
117  }
118  }
119 
123  public void CopyTo(Oid[] array, int index)
124  {
125  ((ICollection)this).CopyTo((Array)array, index);
126  }
127  }
128 }
The exception that is thrown when a null reference (Nothing in Visual Basic) is passed to a method th...
Represents a collection of T:System.Security.Cryptography.Oid objects. This class cannot be inherited...
Definition: OidCollection.cs:7
object SyncRoot
Gets an object that can be used to synchronize access to the T:System.Security.Cryptography....
Represents a cryptographic object identifier. This class cannot be inherited.
Definition: Oid.cs:6
Definition: __Canon.cs:3
int Count
Gets the number of T:System.Security.Cryptography.Oid objects in a collection.
OidGroup
Identifies Windows cryptographic object identifier (OID) groups.
Definition: OidGroup.cs:4
bool IsSynchronized
Gets a value that indicates whether access to the T:System.Security.Cryptography.OidCollection object...
Exposes an enumerator, which supports a simple iteration over a non-generic collection....
Definition: IEnumerable.cs:9
Provides methods for creating, manipulating, searching, and sorting arrays, thereby serving as the ba...
Definition: Array.cs:17
IEnumerator GetEnumerator()
Returns an enumerator that iterates through a collection.
The exception that is thrown when one of the arguments provided to a method is not valid.
OidEnumerator GetEnumerator()
Returns an T:System.Security.Cryptography.OidEnumerator object that can be used to navigate the T:Sys...
int Add(Oid oid)
Adds an T:System.Security.Cryptography.Oid object to the T:System.Security.Cryptography....
Provides the ability to navigate through an T:System.Security.Cryptography.OidCollection object....
Definition: OidEnumerator.cs:6
void CopyTo(Oid[] array, int index)
Copies the T:System.Security.Cryptography.OidCollection object into an array.
Defines size, enumerators, and synchronization methods for all nongeneric collections.
Definition: ICollection.cs:8
void CopyTo(Array array, int index)
Copies the elements of the T:System.Collections.ICollection to an T:System.Array, starting at a parti...
Supports a simple iteration over a non-generic collection.
Definition: IEnumerator.cs:9
OidCollection()
Initializes a new instance of the T:System.Security.Cryptography.OidCollection class.
Implements the T:System.Collections.IList interface using an array whose size is dynamically increase...
Definition: ArrayList.cs:14