INNER CODE UNIT · C#
GetAllFrames
sdesalas/trifleJS · Extensions.cs:65
public static List<HtmlWindow> GetAllFrames(this HtmlWindow window) {
List<HtmlWindow> ancestors = new List<HtmlWindow> {window};
bool added; int count = 0;
do
{
// Keep recursing until we no longer
// have anything else to add.
added = false;
foreach (HtmlWindow ancestor in ancestors.ToArray())
{
foreach (HtmlWindow frame in ancestor.Frames)
{
if (!ancestors.Contains(frame))
{
ancestors.Add(frame);
added = true;
count++;
}