Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
07/04/19 15:33:31 (5 years ago)
Author:
mkommend
Message:

#2978: Merged 16501-16506 into stable.

Location:
stable
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • stable

  • stable/HeuristicLab.MainForm.WindowsForms/3.3/Controls/ControlExtensions.cs

    r15584 r17069  
    4646      }
    4747    }
    48 
    49     public static IEnumerable<Control> GetNestedControls(this Control control, Func<Control, bool> condition = null) {
    50       if (control == null) yield break;
    51       if (condition == null) condition = (c) => true;
    52 
    53       Queue<Control> unprocessed = new Queue<Control>();
    54       unprocessed.Enqueue(control);
    55 
    56       while (unprocessed.Count > 0) {
    57         Control c = unprocessed.Dequeue();
    58         if (condition(c)) yield return c;
    59         foreach (Control child in c.Controls)
    60           unprocessed.Enqueue(child);
    61       }
    62     }
    6348  }
    6449}
Note: See TracChangeset for help on using the changeset viewer.