Page 1 of 1

Warum ist throw null keine Compiler-Warnung? [Duplikat]

Posted: 12 Jan 2025, 12:17
by Guest
Warum ist throw null in C# keine Compilerwarnung?

Ich habe Code gesehen, der einen throw null; enthielt. Dadurch wird eine neue NullReferenceException ausgelöst.

Warum sollte der Compiler dies nicht mit einer Warnung kennzeichnen?