private static Type GetCollectionType(DataTypes collectionDataType) { switch (collectionDataType) { case DataTypes.List: return(Reflector.ListGenType); case DataTypes.LinkedList: return(typeof(LinkedList <>)); case DataTypes.HashSet: return(typeof(HashSet <>)); case DataTypes.Queue: return(typeof(Queue <>)); case DataTypes.Stack: return(typeof(Stack <>)); case DataTypes.CircularList: return(typeof(CircularList <>)); #if !NET35 case DataTypes.SortedSet: return(typeof(SortedSet <>)); case DataTypes.ConcurrentBag: return(typeof(ConcurrentBag <>)); case DataTypes.ConcurrentQueue: return(typeof(ConcurrentQueue <>)); case DataTypes.ConcurrentStack: return(typeof(ConcurrentStack <>)); #endif case DataTypes.ArrayList: return(typeof(ArrayList)); case DataTypes.Hashtable: return(typeof(Hashtable)); case DataTypes.QueueNonGeneric: return(typeof(Queue)); case DataTypes.StackNonGeneric: return(typeof(Stack)); case DataTypes.StringCollection: return(Reflector.StringCollectionType); case DataTypes.Dictionary: return(Reflector.DictionaryGenType); case DataTypes.SortedList: return(typeof(SortedList <,>)); case DataTypes.SortedDictionary: return(typeof(SortedDictionary <,>)); case DataTypes.CircularSortedList: return(typeof(CircularSortedList <,>)); #if !NET35 case DataTypes.ConcurrentDictionary: return(typeof(ConcurrentDictionary <,>)); #endif case DataTypes.SortedListNonGeneric: return(typeof(SortedList)); case DataTypes.ListDictionary: return(typeof(ListDictionary)); case DataTypes.HybridDictionary: return(typeof(HybridDictionary)); case DataTypes.OrderedDictionary: return(typeof(OrderedDictionary)); case DataTypes.StringDictionary: return(typeof(StringDictionary)); case DataTypes.DictionaryEntry: return(Reflector.DictionaryEntryType); case DataTypes.DictionaryEntryNullable: return(typeof(DictionaryEntry?)); case DataTypes.KeyValuePair: return(Reflector.KeyValuePairType); case DataTypes.KeyValuePairNullable: return(Reflector.NullableType.GetGenericType(Reflector.KeyValuePairType)); #if NET35 case DataTypes.ConcurrentDictionary: case DataTypes.SortedSet: case DataTypes.ConcurrentBag: case DataTypes.ConcurrentQueue: case DataTypes.ConcurrentStack: return(Throw.PlatformNotSupportedException <Type>(Res.BinarySerializationCollectionPlatformNotSupported(DataTypeToString(collectionDataType)))); #endif default: return(Throw.SerializationException <Type>(Res.BinarySerializationCannotDecodeCollectionType(DataTypeToString(collectionDataType)))); } }