Note
Whenever possible, try to use the generic TryAddRange<T> overload for better performance.
public static bool TryAddRange(
this IEnumerable target,
IEnumerable collection,
bool checkReadOnly = true,
bool throwError = true
)
<ExtensionAttribute>
Public Shared Function TryAddRange (
target As IEnumerable,
collection As IEnumerable,
Optional checkReadOnly As Boolean = true,
Optional throwError As Boolean = true
) As Boolean
public:
[ExtensionAttribute]
static bool TryAddRange(
IEnumerable^ target,
IEnumerable^ collection,
bool checkReadOnly = true,
bool throwError = true
)
[<ExtensionAttribute>]
static member TryAddRange :
target : IEnumerable *
collection : IEnumerable *
?checkReadOnly : bool *
?throwError : bool
(* Defaults:
let _checkReadOnly = defaultArg checkReadOnly true
let _throwError = defaultArg throwError true
*)
-> bool
The collection can be added to the target collection if that is either an ICollectionT, IProducerConsumerCollectionT or IList implementation.
If target is neither a ListT nor an ISupportsRangeCollectionT implementation, then the elements of collection will only be added one by one.