Check out example codes for "trhow exception if is null c#". It will help you in understanding the concepts better.

Code Example 1

public Exception GetException(object instance)
{
    return (instance == null) ? new ArgumentNullException() : new ArgumentException();
}

public void Main()
{
    object something = null;
    throw GetException(something);
}

Code Example 2

var firstName = name ?? throw new ArgumentException("Mandatory parameter", nameof(name),);

Learn ReactJs, React Native from akashmittal.com