OidCollection.cs 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. //
  2. // OidCollection.cs - System.Security.Cryptography.OidCollection
  3. //
  4. // Author:
  5. // Sebastien Pouliot ([email protected])
  6. //
  7. // (C) 2003 Motus Technologies Inc. (http://www.motus.com)
  8. //
  9. #if NET_1_2
  10. using System;
  11. using System.Collections;
  12. namespace System.Security.Cryptography {
  13. // Note: Match the definition of framework version 1.2.3400.0 on http://longhorn.msdn.microsoft.com
  14. public sealed class OidCollection : ICollection, IEnumerable {
  15. private ArrayList _list;
  16. // constructors
  17. public OidCollection ()
  18. {
  19. _list = new ArrayList ();
  20. }
  21. // properties
  22. public int Count {
  23. get { return _list.Count; }
  24. }
  25. public bool IsSynchronized {
  26. get { return _list.IsSynchronized; }
  27. }
  28. public Oid this [int index] {
  29. get { return (Oid) _list [index]; }
  30. }
  31. public Oid this [string oid] {
  32. get {
  33. foreach (Oid o in _list) {
  34. if (o.Value == oid)
  35. return o;
  36. }
  37. return null;
  38. }
  39. }
  40. public object SyncRoot {
  41. get { return _list.SyncRoot; }
  42. }
  43. // methods
  44. public int Add (Oid oid)
  45. {
  46. return _list.Add (oid);
  47. }
  48. public void CopyTo (Oid[] array, int index)
  49. {
  50. _list.CopyTo ((Array)array, index);
  51. }
  52. // to satisfy ICollection - private
  53. void ICollection.CopyTo (Array array, int index)
  54. {
  55. _list.CopyTo (array, index);
  56. }
  57. public OidEnumerator GetEnumerator ()
  58. {
  59. return new OidEnumerator (this);
  60. }
  61. // to satisfy IEnumerator - private
  62. IEnumerator IEnumerable.GetEnumerator ()
  63. {
  64. return new OidEnumerator (this);
  65. }
  66. }
  67. }
  68. #endif