Marshaling of generic IEnumerable

Fixing defect http://adsk-oss.myjetbrains.com/youtrack/issue/MAGN-2292

Extracted element type from generic type and used that to construct
array, so that the typed array can be converted to IEnumerable<T>