我正在尝试打开所有打开的窗口。我尝试使用,但在循环System.Windows.Application.Current.Windows
所在的行中出现空指针异常。foreach
有谁知道出了什么问题?
public Window getWindow(String Title)
{
Window windowObject = null;
Console.WriteLine("Inside getWindow");
foreach (Window window in System.Windows.Application.Current.Windows)
{
if (window.Title == Title)
{
windowObject = window;
}
}
return windowObject;
}