using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Test
{
class MyException : Exception
{
}
}
if (result == false)
{
throw new MyException();
}
I call this class as belowCode: [Select]if (result == false)
{
throw new MyException();
}
if (!result)
{
throw new MyException();
}
I believe you'll need to add constructors to the class
eg
https://msdn.microsoft.com/en-us/library/87cdya3t(v=vs.110).aspx
try
{
if (!result)
{
throw new MyException();
}
}
catch (Exception ex)
{
throw;
}
Still the same. I don't want the execution to continue when throw new MyException is reached. That is, the execution should stop. Is there any other method.
Exactly! I call a wpf window with an OK and Cancel button, from a class. When the user clicks on the Cancel button, the code should exit. Instead, it continues to execute. To avoid this, I call this MyException class, so that it simple exits. Is there any other way to quit the application if the user clicks on the Cancel button?
Thanks
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
<Button Width="75" Content="Cancel" Margin="5" IsCancel="True"/>
<Button Width="75" Content="OK" Margin="5" IsDefault="True" Click="OkClicked"/>
</StackPanel>
every time you do that Zod kills a little kitten.
every time you do that Zod kills a little kitten.
Made me laugh. ;D ;D