If I do the following:
public class Test
{
public static void Main()
{
List<Person> persons = new List<Person> { new Person() };
persons[0].Sneezing += new EventHandler(Person_Sneezing);
persons = null;
}
public static void Person_Sneezing(object sender, EventArgs e)
{
(sender as Person).CoverFace();
}
}
Does the person that was in person[0] still exists in memory because it's Sneezing delegate has a reference to the Person_Sneezing method or does it get collected by the GC?