I have an array that contains 2 elements and each element can contain one or more object with two properties: Id -> (string) and Names -> (List<string>).
You'll probably understand better by taking a look at the following image:

How can I loop through the elements of the second object and get the Id and Names properties for each of them?
This is how I've tried to implement it, but doesn't work:
foreach (var elem in classArray[1].GetType().GetProperties())
{
var id = elem.Id;
var name = elem.Names;
}
This is the Classification class:
public class Classification
{
public string Id { get; set; }
public List<string> Names { get; set; }
}
This is my code:
List<object> classCollection = new List<object>();
dynamic response = JsonConvert.DeserializeObject(result);
for (int i = 0; i < response.Count; i++)
{
var classObj = response[i].element_classifications;
var className = new List<string>();
List<Classification> classList = new List<Classification>();
for (int k = 0; k < classObj.Count; k++)
{
var classification = classObj[k].classifications;
for (int j = 0; j < classification.Count; j++)
{
className.Add(classification[j].name.Value);
}
classList.Add(new Classification { Id = classObj[k].id.Value, Names = className });
}
classCollection.Add(classList);
}
var classArray = classCollection.ToArray();
ExcelSDRAddIn.UserControlSDR.Classification?object[]then if the items are all of the same type? Using a strongly-typed collection will make life a lot easier.