Answers for "throw an error message c#"

C#
14

c# throw new exception

static void CopyObject(SampleClass original)
{
    if (original == null)
    {
        throw new System.ArgumentException("Parameter cannot be null", "original");
    }
}
Posted by: Guest on February-26-2020
1

c# throw exception

try 
{
  //code
} catch (Exception ex){
  throw new Exception(ex.Message);
}
Posted by: Guest on September-27-2021

C# Answers by Framework

Browse Popular Code Answers by Language