How to check if a dynamic object is an array in c#?

.net, c#

Solution

Use `Type.IsArray`:

From MSDN:

int [] array = {1,2,3,4};
Type t = array.GetType();
// t.IsArray == true
Console.WriteLine("The type is {0}. Is this type an array? {1}", t, t.IsArray); 

Problem

I have a `dynamic` object that sometimes is an `object` and sometimes is an `object[]`. How can I check if the dynamic object is an array?

Original source