Can you use generic forms in C#?

You should be able to create a generic form:

public partial class MyGenericForm :
Form where T : class
{
/* form code */
public List TypedList { get; set; }
}
Is valid …

Detect reason for form closing

How can I detect how a windows form is being closed? For example, how do I find out whether the user has clicked on a button which closes the form or if the user clicks on the “X” in the upper-right? …