I have an object that could be any type. I have a check to see if its an array and then I need to convert it to a List<object>
if it is. I am having trouble handling the case where its a primitive array as shown below. It is not an IEnumerable<object>
in this case. Note I cannot use LINQ in this framework:
object value = SomeFunction();
if( value.GetType().IsArray )
{
try
{
List<object> l = new List<object>( (IEnumerable<object>)value );
}
catch(Exception e)
{
//here its failing because its no an object
}
}
`