EDIT: Corrected my answer after checking some of the rules around casting to type Array
.
All specific types of arrays, such as int[]
, string[]
, or MyCustomObject[]
derive from the base Array
class, and as such, they implement the ICollection
interface, which is what the ArrayList.AddRange
method accepts as a parameter.
Assuming that your contentArrayList
variable is an ArrayList
object, you should be able to cast your loadedContent
variable to ICollection
:
contentArrayList.AddRange((ICollection)loadedContent)
Alternatively, you could combine the check for whether it is an array with the cast:
Array loadedContentAsArray = loadedContent as Array;
if (loadedContentAsArray != null)
{
contentArrayList.AddRange(loadedContentAsArray);
}