|
2 | 2 | // Created by basicx-StrgV // |
3 | 3 | // https://github.com/basicx-StrgV/ // |
4 | 4 | //--------------------------------------------------// |
| 5 | +using System; |
| 6 | + |
5 | 7 | namespace WGetNET.HelperClasses |
6 | 8 | { |
7 | 9 | /// <summary> |
@@ -32,8 +34,7 @@ public static T[] Add<T>(T[] inputArray, T value) |
32 | 34 | return inputArray; |
33 | 35 | } |
34 | 36 |
|
35 | | - //Add a entry to the main array. |
36 | | - inputArray = CopyTo(inputArray, 1); |
| 37 | + Array.Resize(ref inputArray, inputArray.Length + 1); |
37 | 38 |
|
38 | 39 | //Add the new line to the new enty in the main array. |
39 | 40 | #if NETCOREAPP3_1_OR_GREATER |
@@ -121,34 +122,6 @@ public static string[] RemoveEmptyEntries(string[] inputArray) |
121 | 122 | return newArray; |
122 | 123 | } |
123 | 124 |
|
124 | | - /// <summary> |
125 | | - /// Copys a <see langword="array"/> to a new one. |
126 | | - /// </summary> |
127 | | - /// <typeparam name="T"> |
128 | | - /// The type of the array. |
129 | | - /// </typeparam> |
130 | | - /// <param name="inputArray"> |
131 | | - /// The <see langword="array"/> that should be copyed. |
132 | | - /// </param> |
133 | | - /// <param name="addLengthOf"> |
134 | | - /// A <see cref="System.Int32"/> representing a extra length, |
135 | | - /// that should be added to the end of the new array. (DEFAULT = 0) |
136 | | - /// </param> |
137 | | - /// <returns> |
138 | | - /// The new <see langword="array"/>. |
139 | | - /// </returns> |
140 | | - private static T[] CopyTo<T>(T[] inputArray, int addLengthOf = 0) |
141 | | - { |
142 | | - //Copy the input array to the new array. |
143 | | - T[] newArray = new T[inputArray.Length + addLengthOf]; |
144 | | - for (int i = 0; i < inputArray.Length; i++) |
145 | | - { |
146 | | - newArray[i] = inputArray[i]; |
147 | | - } |
148 | | - |
149 | | - return newArray; |
150 | | - } |
151 | | - |
152 | 125 | /// <summary> |
153 | 126 | /// Copys a <see langword="array"/> to a new one, but ignores the given range. |
154 | 127 | /// </summary> |
|
0 commit comments