I need your help in implementing an exception code with 'try ~ catch' in C#.
My motive is to follow 'try ~ except' in python like below:
try:
pass
except KeyboardInterrupt as e:
print("Closed...")
break
I thought there was also the interrupt exception keyword like Python in C#.
So, I tried like:
try
{
// pass
}
catch (ThreadInterruptedException e)
{
Console.Write("Closed...");
break;
}
But, this C# code couldn't catch the interrupt signal by ctrl+C.
I assumed 'ThreadInterruptedException' is for that, but it isn't.
Which keyword should I use?
I have tried to google, but there are a number of examples about 'how to get 'ctrl+v' value through my console.