IdCollection.cs 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Collections;
  4. using System.Text;
  5. namespace SysBaseLibs
  6. {
  7. public class IdCollection : CollectionBase
  8. {
  9. // Methods
  10. public IdCollection()
  11. { }
  12. public int Add(INpId poObject)
  13. {
  14. return base.InnerList.Add(poObject);
  15. }
  16. public bool Contains(INpId poObject)
  17. {
  18. return (this.IndexOf(poObject) >= 0);
  19. }
  20. public bool Contains(string pcId)
  21. {
  22. return (this.IndexOf(pcId) >= 0);
  23. }
  24. public int IndexOf(INpId poObject)
  25. {
  26. return this.IndexOf(poObject.Id);
  27. }
  28. public int IndexOf(string pcId)
  29. {
  30. int num1 = -1;
  31. pcId = UtilStr.UAndT(pcId);
  32. for (int num2 = 0; num2 < base.InnerList.Count; num2++)
  33. {
  34. INpId id1 = (INpId)base.InnerList[num2];
  35. if (UtilStr.UAndT(id1.Id) == pcId)
  36. {
  37. return num2;
  38. }
  39. }
  40. return num1;
  41. }
  42. public void Remove(INpId poObject)
  43. {
  44. base.InnerList.Remove(poObject);
  45. }
  46. public void Remove(string pcId)
  47. {
  48. int num1 = this.IndexOf(pcId);
  49. if (num1 >= 0)
  50. {
  51. base.RemoveAt(num1);
  52. }
  53. }
  54. // Properties
  55. public INpId this[int piIndex]
  56. {
  57. get
  58. {
  59. if ((piIndex < base.InnerList.Count) && (piIndex >= 0))
  60. {
  61. return (INpId)base.InnerList[piIndex];
  62. }
  63. return null;
  64. }
  65. }
  66. public INpId this[string pcId]
  67. {
  68. get
  69. {
  70. int num1 = this.IndexOf(pcId);
  71. if (num1 >= 0)
  72. {
  73. return (INpId)base.InnerList[num1];
  74. }
  75. return null;
  76. }
  77. }
  78. }
  79. }