Best exception for an invalid generic type argument

后端 未结 11 1202
孤城傲影
孤城傲影 2020-12-08 18:21

I\'m currently writing some code for UnconstrainedMelody which has generic methods to do with enums.

Now, I have a static class with a bunch of methods which are

11条回答
  •  情深已故
    2020-12-08 18:36

    I would use NotSupportedException as that is what you are saying. Other enums than the specific ones are not supported. This would of course be stated more clearly in the exception message.

提交回复
热议问题