c# throw new exception
static void CopyObject(SampleClass original)
{
if (original == null)
{
throw new System.ArgumentException("Parameter cannot be null", "original");
}
}
c# throw new exception
static void CopyObject(SampleClass original)
{
if (original == null)
{
throw new System.ArgumentException("Parameter cannot be null", "original");
}
}
C# Throw Exception
int num1, num2, result;
Console.WriteLine("Enter First Number");
num1 = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("Enter Second Number");
num2 = Convert.ToInt32(Console.ReadLine());
try
{
if (num2 == 0)
{
throw new Exception("Can't Divide by Zero Exception\n\n");
}
result = num1 / num2;
Console.WriteLine("{0} / {1} = {2}", num1, num2, result);
}
catch (Exception e)
{
Console.WriteLine("Error: " + e.ToString());
}
Console.ReadLine();
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us