I was trying out some code in my catch method, and I wanted to try out the exception that it generates. but in order to reach the catch method, I need to crash my program, so it'll be caught and create an exception.
try
{
//do something
}
catch (Exception ex)
{
MessageBox.Show("There was an error, please contact the staff");
using (StreamWriter writer = new StreamWriter(Application.StartupPath + "\\Crashlog\\Crashfile.txt"))
{
writer.WriteLine(ex.ToString());
}
}
Now I wonder, what's an easy, and simple to memorise, line of code that surely makes your program reach that catch method and generate an exception?