Changeset 6500 for trunk/sources
- Timestamp:
- 07/04/11 13:07:34 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Common/3.3/ObjectExtensions.cs
r6380 r6500 26 26 using System.Linq; 27 27 using System.Reflection; 28 using System.Threading; 28 29 29 30 namespace HeuristicLab.Common { … … 38 39 while (stack.Count > 0) { 39 40 object current = stack.Pop(); 40 Type type = obj.GetType();41 41 objects.Add(current); 42 42 … … 71 71 Type type = obj.GetType(); 72 72 73 if (type.IsSubclassOfRawGeneric(typeof(Dictionary<,>)) || 74 type.IsSubclassOfRawGeneric(typeof(SortedDictionary<,>)) || 75 type.IsSubclassOfRawGeneric(typeof(SortedList<,>)) || 76 obj is SortedList || 77 obj is OrderedDictionary || 78 obj is ListDictionary || 79 obj is Hashtable) { 73 if (type.IsSubclassOfRawGeneric(typeof(ThreadLocal<>))) { 74 PropertyInfo info = type.GetProperty("Value"); 75 object value = info.GetValue(obj, null); 76 if (value != null) yield return value; 77 } else if (type.IsSubclassOfRawGeneric(typeof(Dictionary<,>)) || 78 type.IsSubclassOfRawGeneric(typeof(SortedDictionary<,>)) || 79 type.IsSubclassOfRawGeneric(typeof(SortedList<,>)) || 80 obj is SortedList || 81 obj is OrderedDictionary || 82 obj is ListDictionary || 83 obj is Hashtable) { 80 84 var dictionary = obj as IDictionary; 81 85 foreach (object value in dictionary.Keys)
Note: See TracChangeset
for help on using the changeset viewer.