Exemplo n.º 1
0
        private void InvalidCastExceptionFromObjectToIntButton_Click(object sender, EventArgs e)
        {
            var ops = new VariousCommonExceptions();

            ops.InvalidCastException();

            MessageBox.Show(ops.IsSuccessFul ? "Success" : $"{ops.LastExceptionMessage}");
        }
Exemplo n.º 2
0
        private void InvalidOperationExceptionButton_Click(object sender, EventArgs e)
        {
            var ops = new VariousCommonExceptions();

            ops.InvalidOperationException();

            MessageBox.Show(ops.IsSuccessFul ? "Success" : $"{ops.LastExceptionMessage}");

            ops.ValidOperationDoneRight();
            MessageBox.Show(ops.IsSuccessFul ? "Success" : $"{ops.LastExceptionMessage}");
        }