@@ -28,7 +28,7 @@ public static partial class Collection
28
28
/// <returns>Returns an enumerable populated with the specified items.</returns>
29
29
public static IEnumerable < T > EnumerableOf < T > ( params T [ ] items )
30
30
{
31
- return items . Copy ( ) ;
31
+ return items ;
32
32
}
33
33
34
34
/// <summary>
@@ -39,7 +39,7 @@ public static IEnumerable<T> EnumerableOf<T>(params T[] items)
39
39
/// <returns>Returns an array populated with the specified items.</returns>
40
40
public static T [ ] ArrayOf < T > ( params T [ ] items )
41
41
{
42
- return items . Copy ( ) ;
42
+ return items ;
43
43
}
44
44
45
45
/// <summary>
@@ -50,7 +50,7 @@ public static T[] ArrayOf<T>(params T[] items)
50
50
/// <returns>Returns an immutable array populated with the specified items.</returns>
51
51
public static ImmutableArray < T > ImmutableArrayOf < T > ( params T [ ] items )
52
52
{
53
- return ArrayOf ( items ) . ToImmutableArray ( ) ;
53
+ return ImmutableArray . Create ( items ) ;
54
54
}
55
55
56
56
/// <summary>
@@ -61,7 +61,7 @@ public static ImmutableArray<T> ImmutableArrayOf<T>(params T[] items)
61
61
/// <returns>Returns a list populated with the specified items.</returns>
62
62
public static List < T > ListOf < T > ( params T [ ] items )
63
63
{
64
- return new List < T > ( items . Copy ( ) ) ;
64
+ return new List < T > ( items ) ;
65
65
}
66
66
67
67
/// <summary>
@@ -72,7 +72,7 @@ public static List<T> ListOf<T>(params T[] items)
72
72
/// <returns>Returns an immutable list populated with the specified items.</returns>
73
73
public static ImmutableList < T > ImmutableListOf < T > ( params T [ ] items )
74
74
{
75
- return ListOf ( items ) . ToImmutableList ( ) ;
75
+ return ImmutableList . Create ( items ) ;
76
76
}
77
77
78
78
/// <summary>
@@ -84,7 +84,7 @@ public static ImmutableList<T> ImmutableListOf<T>(params T[] items)
84
84
/// <returns>Returns a dictionary populated with the specified items.</returns>
85
85
public static Dictionary < TKey , TValue > DictionaryOf < TKey , TValue > ( params KeyValuePair < TKey , TValue > [ ] items ) where TKey : notnull
86
86
{
87
- return new Dictionary < TKey , TValue > ( items . Copy ( ) ) ;
87
+ return new Dictionary < TKey , TValue > ( items ) ;
88
88
}
89
89
90
90
/// <summary>
@@ -109,7 +109,7 @@ public static Dictionary<TKey, TValue> DictionaryOf<TKey, TValue>(params (TKey k
109
109
public static ImmutableDictionary < TKey , TValue > ImmutableDictionaryOf < TKey , TValue > (
110
110
params KeyValuePair < TKey , TValue > [ ] items ) where TKey : notnull
111
111
{
112
- return DictionaryOf ( items ) . ToImmutableDictionary ( ) ;
112
+ return ImmutableDictionary . CreateRange ( items ) ;
113
113
}
114
114
115
115
/// <summary>
@@ -122,7 +122,7 @@ public static ImmutableDictionary<TKey, TValue> ImmutableDictionaryOf<TKey, TVal
122
122
public static ImmutableDictionary < TKey , TValue > ImmutableDictionaryOf < TKey , TValue > (
123
123
params ( TKey key , TValue value ) [ ] items ) where TKey : notnull
124
124
{
125
- return DictionaryOf ( items ) . ToImmutableDictionary ( ) ;
125
+ return ImmutableDictionary . CreateRange ( items . Select ( item => new KeyValuePair < TKey , TValue > ( item . key , item . value ) ) ) ;
126
126
}
127
127
128
128
/// <summary>
@@ -161,7 +161,7 @@ public static SortedDictionary<TKey, TValue> SortedDictionaryOf<TKey, TValue>(
161
161
public static ImmutableSortedDictionary < TKey , TValue > ImmutableSortedDictionaryOf < TKey , TValue > (
162
162
params KeyValuePair < TKey , TValue > [ ] items ) where TKey : notnull
163
163
{
164
- return SortedDictionaryOf ( items ) . ToImmutableSortedDictionary ( ) ;
164
+ return ImmutableSortedDictionary . CreateRange ( items ) ;
165
165
}
166
166
167
167
/// <summary>
@@ -174,7 +174,7 @@ public static ImmutableSortedDictionary<TKey, TValue> ImmutableSortedDictionaryO
174
174
public static ImmutableSortedDictionary < TKey , TValue > ImmutableSortedDictionaryOf < TKey , TValue > (
175
175
params ( TKey key , TValue value ) [ ] items ) where TKey : notnull
176
176
{
177
- return SortedDictionaryOf ( items ) . ToImmutableSortedDictionary ( ) ;
177
+ return ImmutableSortedDictionary . CreateRange ( items . Select ( item => new KeyValuePair < TKey , TValue > ( item . key , item . value ) ) ) ;
178
178
}
179
179
180
180
/// <summary>
@@ -185,7 +185,7 @@ public static ImmutableSortedDictionary<TKey, TValue> ImmutableSortedDictionaryO
185
185
/// <returns>Returns a hash set populated with the specified items.</returns>
186
186
public static HashSet < T > HashSetOf < T > ( params T [ ] items )
187
187
{
188
- return new HashSet < T > ( items . Copy ( ) ) ;
188
+ return new HashSet < T > ( items ) ;
189
189
}
190
190
191
191
/// <summary>
@@ -196,7 +196,7 @@ public static HashSet<T> HashSetOf<T>(params T[] items)
196
196
/// <returns>Returns an immutable hash set populated with the specified items.</returns>
197
197
public static ImmutableHashSet < T > ImmutableHashSetOf < T > ( params T [ ] items )
198
198
{
199
- return HashSetOf ( items ) . ToImmutableHashSet ( ) ;
199
+ return ImmutableHashSet . Create ( items ) ;
200
200
}
201
201
202
202
/// <summary>
@@ -207,7 +207,7 @@ public static ImmutableHashSet<T> ImmutableHashSetOf<T>(params T[] items)
207
207
/// <returns>Returns a sorted set populated with the specified items.</returns>
208
208
public static SortedSet < T > SortedSetOf < T > ( params T [ ] items )
209
209
{
210
- return new SortedSet < T > ( items . Copy ( ) ) ;
210
+ return new SortedSet < T > ( items ) ;
211
211
}
212
212
213
213
/// <summary>
@@ -218,7 +218,7 @@ public static SortedSet<T> SortedSetOf<T>(params T[] items)
218
218
/// <returns>Returns an immutable sorted set populated with the specified items.</returns>
219
219
public static ImmutableSortedSet < T > ImmutableSortedSetOf < T > ( params T [ ] items )
220
220
{
221
- return SortedSetOf ( items ) . ToImmutableSortedSet ( ) ;
221
+ return ImmutableSortedSet . Create ( items ) ;
222
222
}
223
223
224
224
/// <summary>
@@ -229,7 +229,7 @@ public static ImmutableSortedSet<T> ImmutableSortedSetOf<T>(params T[] items)
229
229
/// <returns>Returns a stack populated with the specified items.</returns>
230
230
public static Stack < T > StackOf < T > ( params T [ ] items )
231
231
{
232
- return new Stack < T > ( items . Copy ( ) ) ;
232
+ return new Stack < T > ( items ) ;
233
233
}
234
234
235
235
/// <summary>
@@ -240,7 +240,7 @@ public static Stack<T> StackOf<T>(params T[] items)
240
240
/// <returns>Returns an immutable stack populated with the specified items.</returns>
241
241
public static ImmutableStack < T > ImmutableStackOf < T > ( params T [ ] items )
242
242
{
243
- return ImmutableStack . Create ( items . Copy ( ) ) ;
243
+ return ImmutableStack . Create ( items ) ;
244
244
}
245
245
246
246
/// <summary>
@@ -251,7 +251,7 @@ public static ImmutableStack<T> ImmutableStackOf<T>(params T[] items)
251
251
/// <returns>Returns a queue populated with the specified items.</returns>
252
252
public static Queue < T > QueueOf < T > ( params T [ ] items )
253
253
{
254
- return new Queue < T > ( items . Copy ( ) ) ;
254
+ return new Queue < T > ( items ) ;
255
255
}
256
256
257
257
/// <summary>
@@ -262,6 +262,6 @@ public static Queue<T> QueueOf<T>(params T[] items)
262
262
/// <returns>Returns an immutable queue populated with the specified items.</returns>
263
263
public static ImmutableQueue < T > ImmutableQueueOf < T > ( params T [ ] items )
264
264
{
265
- return ImmutableQueue . Create ( items . Copy ( ) ) ;
265
+ return ImmutableQueue . Create ( items ) ;
266
266
}
267
267
}
0 commit comments