StringCollection.cs 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System.Runtime.InteropServices;
  4. namespace WinSCP
  5. {
  6. [Guid("E402CB1F-6219-4C79-9EDF-1914D9589909")]
  7. [ClassInterface(Constants.ClassInterface)]
  8. [ComVisible(true)]
  9. public class StringCollection : ICollection<string>
  10. {
  11. internal StringCollection()
  12. {
  13. }
  14. public string this[int index]
  15. {
  16. get
  17. {
  18. return _helper[index];
  19. }
  20. set
  21. {
  22. _helper[index] = value;
  23. }
  24. }
  25. #region ICollection<string> Members
  26. public void Add(string item)
  27. {
  28. _helper.Add(item);
  29. }
  30. public void Clear()
  31. {
  32. _helper.Clear();
  33. }
  34. public bool Contains(string item)
  35. {
  36. return _helper.Contains(item);
  37. }
  38. public void CopyTo(string[] array, int arrayIndex)
  39. {
  40. _helper.CopyTo(array, arrayIndex);
  41. }
  42. public int Count
  43. {
  44. get { return _helper.Count; }
  45. }
  46. public bool IsReadOnly
  47. {
  48. get { return _helper.IsReadOnly; }
  49. }
  50. public bool Remove(string item)
  51. {
  52. return _helper.Remove(item);
  53. }
  54. #endregion
  55. #region IEnumerable<SessionRemoteException> Members
  56. IEnumerator<string> IEnumerable<string>.GetEnumerator()
  57. {
  58. return _helper.GetEnumerator();
  59. }
  60. #endregion
  61. #region IEnumerable Members
  62. public IEnumerator GetEnumerator()
  63. {
  64. return _helper.GetEnumerator();
  65. }
  66. #endregion
  67. internal void InternalAdd(string item)
  68. {
  69. _helper.InternalAdd(item);
  70. }
  71. internal void InternalRemoveFirst()
  72. {
  73. _helper.InternalRemoveFirst();
  74. }
  75. private readonly ReadOnlyInteropCollectionHelper<string> _helper = new ReadOnlyInteropCollectionHelper<string>();
  76. }
  77. }