public Expression[] AppendObjectMembers(DebugType type, BindingFlags bindingFlags) { List <Expression> members = new List <Expression>(); foreach (FieldInfo field in type.GetFields(bindingFlags)) { members.Add(this.AppendFieldReference(field)); } foreach (PropertyInfo property in type.GetProperties(bindingFlags)) { members.Add(this.AppendPropertyReference(property)); } members.Sort(); return(members.ToArray()); }
IEnumerable <NamedValue> GetObjectMembersEnum(DebugType type, BindingFlags bindingFlags) { DebugType currentType = type ?? this.Type; while (currentType != null) { foreach (FieldInfo field in currentType.GetFields(bindingFlags)) { yield return(field.GetValue(this)); } foreach (PropertyInfo property in currentType.GetProperties(bindingFlags)) { yield return(property.GetValue(this)); } if (type == null) { currentType = currentType.BaseType; } else { yield break; } } }