DataKeyCollection.cs 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. /**
  2. * Namespace: System.Web.UI.WebControls
  3. * Class: DataKeyCollection
  4. *
  5. * Author: Gaurav Vaish
  6. * Maintainer: [email protected]
  7. * Contact: <[email protected]>, <[email protected]>
  8. * Implementation: yes
  9. * Status: 100%
  10. *
  11. * (C) Gaurav Vaish (2002)
  12. */
  13. using System;
  14. using System.Web;
  15. using System.Web.UI;
  16. namespace System.Web.UI.WebControls
  17. {
  18. public sealed class DataKeyCollection : ICollection, IEnumerable
  19. {
  20. private ArrayList keys;
  21. public DataKeyCollection(ArrayList keys)
  22. {
  23. this.keys = keys;
  24. }
  25. public int Count
  26. {
  27. get
  28. {
  29. return keys.Count;
  30. }
  31. }
  32. public bool IsReadOnly
  33. {
  34. get
  35. {
  36. return false;
  37. }
  38. }
  39. public bool IsSynchronized
  40. {
  41. get
  42. {
  43. return false;
  44. }
  45. }
  46. public object this[int index]
  47. {
  48. get
  49. {
  50. return keys[index];
  51. }
  52. }
  53. public object SyncRoot
  54. {
  55. get
  56. {
  57. return this;
  58. }
  59. }
  60. public void CopyTo(Array array, int index)
  61. {
  62. foreach(object current in this)
  63. {
  64. array.SetValue(current, index++);
  65. }
  66. }
  67. public IEnumerator GetEnumerator()
  68. {
  69. return keys.GetEnumerator();
  70. }
  71. }
  72. }