CodeDirectiveCollection.cs 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. //
  2. // System.CodeDom CodeDirectiveCollection class
  3. //
  4. // Authors:
  5. // Marek Safar ([email protected])
  6. // Sebastien Pouliot <[email protected]>
  7. //
  8. // (C) 2004 Ximian, Inc.
  9. // Copyright (C) 2005 Novell, Inc (http://www.novell.com)
  10. //
  11. // Permission is hereby granted, free of charge, to any person obtaining
  12. // a copy of this software and associated documentation files (the
  13. // "Software"), to deal in the Software without restriction, including
  14. // without limitation the rights to use, copy, modify, merge, publish,
  15. // distribute, sublicense, and/or sell copies of the Software, and to
  16. // permit persons to whom the Software is furnished to do so, subject to
  17. // the following conditions:
  18. //
  19. // The above copyright notice and this permission notice shall be
  20. // included in all copies or substantial portions of the Software.
  21. //
  22. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  23. // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  24. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  25. // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
  26. // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
  27. // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
  28. // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  29. //
  30. #if NET_2_0
  31. using System.Runtime.InteropServices;
  32. namespace System.CodeDom
  33. {
  34. [Serializable]
  35. [ComVisible (true), ClassInterface (ClassInterfaceType.AutoDispatch)]
  36. public class CodeDirectiveCollection: System.Collections.CollectionBase {
  37. public CodeDirectiveCollection ()
  38. {
  39. }
  40. public CodeDirectiveCollection (CodeDirective[] value)
  41. {
  42. AddRange (value);
  43. }
  44. public CodeDirectiveCollection (CodeDirectiveCollection value)
  45. {
  46. AddRange (value);
  47. }
  48. public CodeDirective this [int index] {
  49. get { return (CodeDirective) List [index]; }
  50. set { List [index] = value; }
  51. }
  52. public int Add (CodeDirective value)
  53. {
  54. return List.Add (value);
  55. }
  56. public void AddRange (CodeDirective[] value)
  57. {
  58. if (value == null) {
  59. throw new ArgumentNullException ("value");
  60. }
  61. for (int i = 0; i < value.Length; i++) {
  62. Add (value[i]);
  63. }
  64. }
  65. public void AddRange (CodeDirectiveCollection value)
  66. {
  67. if (value == null) {
  68. throw new ArgumentNullException ("value");
  69. }
  70. int count = value.Count;
  71. for (int i = 0; i < count; i++) {
  72. Add (value[i]);
  73. }
  74. }
  75. public bool Contains (CodeDirective value)
  76. {
  77. return List.Contains (value);
  78. }
  79. public void CopyTo (CodeDirective[] array, int index)
  80. {
  81. List.CopyTo (array, index);
  82. }
  83. public int IndexOf (CodeDirective value)
  84. {
  85. return List.IndexOf (value);
  86. }
  87. public void Insert (int index, CodeDirective value)
  88. {
  89. List.Insert (index, value);
  90. }
  91. public void Remove (CodeDirective value)
  92. {
  93. List.Remove (value);
  94. }
  95. }
  96. }
  97. #endif