I have a List<dynamic>
and I need to pass the values and type of the list to a service.
The service code would be something like this:
Type type = typeof(IList<>);
// Type genericType = how to get type of list. Such as List<**string**>, List<**dynamic**>, List<**CustomClass**>
// Then I convert data value of list to specified type.
IList data = (IList)JsonConvert.DeserializeObject(this._dataSourceValues[i], genericType);
_dataSourceValues: values in the list
How can I cast the type of the list to a particular type if the type of List is dynamic (List<dynamic>
)?