***how can you implement the constructor without naming or needing the class such
as
EX:
string x = new string()
how can i just implement
new string() by itself without the need for string x.
I known it’s calling the constructor but doesn’t the class has to be initialized?
Ex:
new InvalidOperationException(".....")throw new ArgumentException("...");
Your first example instantiates an
InvalidOperationException(), but can’t do anything with it because it’s not saved to a variable or thrown. If you saved it to a variable, you could throw it later: