private void buttonArrangeWindows_Click(object sender, EventArgs e) { // Using a lambda expression // WindowInformation wi = windowListExtended.Find( // w => w.Caption.StartsWith("c# - How") // ); var windowsToBeArranged = new List <IntPtr>(); var windowsListSecondSet = new List <IntPtr>(); this.windowListBasic.ForEach(x => Logger.Info($" {x.Class} - {x.Caption} ")); foreach (var windowInformation in this.windowListBasic) { if (windowInformation.Class.Contains("SunAwtFrame") && windowInformation.Caption.Contains("5 min bars") && windowInformation.Caption.Contains("@")) { windowsToBeArranged.Add(windowInformation.Handle); } // if (windowInformation.Class.Contains("Chrome_WidgetWin_1") && !string.IsNullOrEmpty(windowInformation.Caption)) // { // windowsToBeArranged.Add(windowInformation.Handle); // } } WindowList.TileWindows(windowsToBeArranged, WindowList.WindowTile.Horizontally, 6, 4); foreach (var windowInformation in this.windowListBasic) { if (windowInformation.Class.Contains("SunAwtFrame") && windowInformation.Caption.Contains("5 min bars")) { windowsListSecondSet.Add(windowInformation.Handle); } // if (windowInformation.Class.Contains("Chrome_WidgetWin_1") && !string.IsNullOrEmpty(windowInformation.Caption)) // { // windowsToBeArranged.Add(windowInformation.Handle); // } } windowsListSecondSet = windowsListSecondSet.Except(windowsToBeArranged).ToList(); WindowList.TileWindows(windowsListSecondSet, WindowList.WindowTile.Vertically, 8, 3, 2); // WindowInformation w2 = windowListBasic.Find( // w => w.Class.Contains("SunAwtFrame") && !w.Caption.Contains("5 min bars") // ); // Using a query expression // WindowInformation wi1 = (from w in windowListExtended.AsEnumerable() // where w.Caption.StartsWith("c# - How") // select w).First(); }