Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
08/07/13 15:55:43 (11 years ago)
Author:
mkommend
Message:

#2095: Merged trunk changes for object graph traversal in the stable branch.

Location:
stable
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • stable

  • stable/HeuristicLab.Common/3.3/TypeExtensions.cs

    r9456 r9869  
    4949
    5050    public static IEnumerable<FieldInfo> GetAllFields(this Type type) {
    51       foreach (var field in type.GetFields(BindingFlags.Instance | BindingFlags.DeclaredOnly | BindingFlags.Public | BindingFlags.NonPublic))
    52         yield return field;
    53 
    54       foreach (var field in type.GetFields(BindingFlags.Static | BindingFlags.DeclaredOnly | BindingFlags.Public | BindingFlags.NonPublic))
    55         yield return field;
    56 
    57       if (type.BaseType != null) {
    58         foreach (var field in type.BaseType.GetAllFields())
     51      while (type != null) {
     52        foreach (var field in type.GetFields(BindingFlags.Static | BindingFlags.Instance | BindingFlags.DeclaredOnly | BindingFlags.Public | BindingFlags.NonPublic))
    5953          yield return field;
     54        type = type.BaseType;
    6055      }
    6156    }
Note: See TracChangeset for help on using the changeset viewer.