I have a function in C#
void func(int x, int y, params object[] arr)
Now this arr can contain anything. For e.g. it can contain an array at [0], a string at [1] and so on.
If I pass the following parameters: func(3, 4, array1, list1, "hello");
array1 is an Array of int, list1 is a List
My question is that how do I extract array1 and list1 from arr and convert it to an Array or List?
Here is a small program. You have mentioned that the arr can be made of anything, so I presume that on the first index there can be List, array, string or anything else, and that there can be many arrays or lists passed.
Therefore you should probably not presume that on particular indexes you can expect elements of particular type.
This solution will extract you all arrays and all lists from arr. Maybe it could be useful for you.