private static bool ConvertForSet(SetDescriptor setDescriptor, ref object data) { if (SetDescriptor.IsSet(data.GetType())) { if (!TryConvertSetData(data, setDescriptor, out data)) { return(false); } } else { object convertedData; if (!TypeConverterHelper.TryConvert(data, setDescriptor.ElementType, out convertedData)) { return(false); } var convertedCollection = Activator.CreateInstance(setDescriptor.Type, true); setDescriptor.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)); }