Windows Forms find all the active Form instance types
WinForms, how to f开发者_Python百科ind all the active windows of specific instance type.
You could do something like this using LINQ:
var forms = from f in Application.OpenForms.OfType<Form1>()
select f;
Or if you had additional criteria, something like:
var forms = from f in Application.OpenForms.OfType<CustomerForm>()
where f.HasChanges
select f;
精彩评论