Changeset 7669 for branches/HeuristicLab.Hive.Azure/HeuristicLab.Common/3.3
- Timestamp:
- 03/28/12 15:47:26 (13 years ago)
- Location:
- branches/HeuristicLab.Hive.Azure
- Files:
-
- 3 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.Hive.Azure
- Property svn:ignore
-
old new 3 3 *.resharper 4 4 *.suo 5 *.user 5 6 *.vsp 6 7 Doxygen 8 FxCopResults.txt 7 9 Google.ProtocolBuffers-0.9.1.dll 8 10 HeuristicLab 3.3.5.1.ReSharper.user
-
- Property svn:mergeinfo changed
- Property svn:ignore
-
branches/HeuristicLab.Hive.Azure/HeuristicLab.Common/3.3/HeuristicLab.Common-3.3.csproj
r6981 r7669 132 132 <Compile Include="Plugin.cs" /> 133 133 <Compile Include="ReferenceEqualityComparer.cs" /> 134 <Compile Include="TypeEqualityComparer.cs" /> 134 135 <Compile Include="TypeExtensions.cs" /> 135 136 <Compile Include="DoubleExtensions.cs"> -
branches/HeuristicLab.Hive.Azure/HeuristicLab.Common/3.3/ObjectExtensions.cs
r7270 r7669 31 31 namespace HeuristicLab.Common { 32 32 public static class ObjectExtensions { 33 public static IEnumerable<object> GetObjectGraphObjects(this object obj, bool excludeStaticMembers = false) {33 public static IEnumerable<object> GetObjectGraphObjects(this object obj, HashSet<string> excludedMembers = null, bool excludeStaticMembers = false) { 34 34 if (obj == null) return Enumerable.Empty<object>(); 35 if (excludedMembers == null) excludedMembers = new HashSet<string>(); 35 36 36 37 var objects = new HashSet<object>(); … … 42 43 objects.Add(current); 43 44 44 foreach (object o in GetChildObjects(current, exclude StaticMembers)) {45 foreach (object o in GetChildObjects(current, excludedMembers, excludeStaticMembers)) { 45 46 if (o != null && !objects.Contains(o) && !ExcludeType(o.GetType())) 46 47 stack.Push(o); … … 70 71 (type.HasElementType && ExcludeType(type.GetElementType())); 71 72 } 72 private static IEnumerable<object> GetChildObjects(object obj, bool excludeStaticMembers) {73 private static IEnumerable<object> GetChildObjects(object obj, HashSet<string> excludedMembers, bool excludeStaticMembers) { 73 74 Type type = obj.GetType(); 74 75 … … 95 96 } else { 96 97 foreach (FieldInfo f in type.GetAllFields()) { 98 if (excludedMembers.Contains(f.Name)) continue; 97 99 if (excludeStaticMembers && f.IsStatic) continue; 98 100 object fieldValue; 99 101 try { 100 102 fieldValue = f.GetValue(obj); 101 } catch (SecurityException) { 103 } 104 catch (SecurityException) { 102 105 continue; 103 106 }
Note: See TracChangeset
for help on using the changeset viewer.