While writing some particularly complex exception handling code, someone asked, don\'t you need to make sure that your exception object isn\'t null? And I said, of course n
In older c#:
Consider this syntax:
public void Add ( T item ) => throw (hashSet.Add ( item ) ? null : new Exception ( "The item already exists" ));
I think it's way shorter than this:
public void Add ( T item ) { if (!hashSet.Add ( item )) throw new Exception ( "The item already exists" ); }