C#

C#

By DeepSource

Getters must not throw exceptions CS-R1038

Anti-pattern

While it is acceptable for setters to throw exceptions, getters are simply expected to return a value. Throwing any exception is considered an antipattern and is not a recommended practice. It is recommended that you refactor your code accordingly.