It would be a lot simpler if you used the relevant interface. In this case, you can use the IEnumerable
interface.
IEnumerable keys = parameter.GetType().GetProperty("Keyframes")
.GetValue(parameter, null) as IEnumerable;
You have to then deal with the type of the enumerated objects, but the enumerable itself is easier to deal with.
IEnumerable
is in the System.Collections
namespace, not System.Collections.Generic
.