private static bool ConvertForList(ListDescriptor listDescriptor, ref object data) { if (ListDescriptor.IsList(data.GetType())) { if (!TryConvertListData(data, listDescriptor, out data)) { return(false); } } else { object convertedData; if (!TypeConverterHelper.TryConvert(data, listDescriptor.ElementType, out convertedData)) { return(false); } var convertedCollection = Activator.CreateInstance(listDescriptor.Type, true); listDescriptor.Add(convertedCollection, convertedData); data = convertedCollection; } return(true); }
private static bool HasCollectionReference(Type type) { return(type.IsArray || ListDescriptor.IsList(type) || DictionaryDescriptor.IsDictionary(type) || SetDescriptor.IsSet(type) || OldCollectionDescriptor.IsCollection(type)); }