Changeset 6760 for branches/PersistenceSpeedUp/HeuristicLab.Persistence/3.3/Default/CompositeSerializers
- Timestamp:
- 09/14/11 13:59:25 (13 years ago)
- Location:
- branches/PersistenceSpeedUp
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/PersistenceSpeedUp
- Property svn:ignore
-
old new 12 12 *.psess 13 13 *.vsp 14 *.docstates
-
- Property svn:mergeinfo changed
- Property svn:ignore
-
branches/PersistenceSpeedUp/HeuristicLab.Persistence
- Property svn:mergeinfo changed
-
branches/PersistenceSpeedUp/HeuristicLab.Persistence/3.3/Default/CompositeSerializers/NumberEnumerable2StringSerializer.cs
r5445 r6760 46 46 47 47 private static readonly Dictionary<Type, Type> interfaceCache = new Dictionary<Type, Type>(); 48 private static readonly object locker = new object(); 48 49 49 50 public Type GetGenericEnumerableInterface(Type type) { 50 if (interfaceCache.ContainsKey(type)) 51 return interfaceCache[type]; 52 foreach (Type iface in type.GetInterfaces()) { 53 if (iface.IsGenericType && 54 iface.GetGenericTypeDefinition() == typeof(IEnumerable<>) && 55 numberConverter.CanSerialize(iface.GetGenericArguments()[0])) { 56 interfaceCache.Add(type, iface); 57 return iface; 51 lock (locker) { 52 if (interfaceCache.ContainsKey(type)) 53 return interfaceCache[type]; 54 foreach (Type iface in type.GetInterfaces()) { 55 if (iface.IsGenericType && 56 iface.GetGenericTypeDefinition() == typeof(IEnumerable<>) && 57 numberConverter.CanSerialize(iface.GetGenericArguments()[0])) { 58 interfaceCache.Add(type, iface); 59 return iface; 60 } 58 61 } 62 interfaceCache.Add(type, null); 59 63 } 60 interfaceCache.Add(type, null);61 64 return null; 62 65 }
Note: See TracChangeset
for help on using the changeset viewer.