I am trying to determine if an object x is a list. It may be a list of any type and with any generic parameter.

If it is, then I want to iterate over it if it is. This is the best I could come up with, but it fails due to a compilation error

```
if(x is List){
    foreach(Object o in (List)x){
        ;
    }
}

```

How can I do this?