How to change “Generate Method Stub” to throw NotImplementedException in VS?

前端 未结 2 395
闹比i
闹比i 2021-01-12 09:37

How can I change default Generate Method Stub behavior in Visaul Studio to generate method with body

throw new NotImplementedException();

i

2条回答
  •  鱼传尺愫
    2021-01-12 10:23

    There's another reason: FxCop catches instances of anybody throwing 'Exception' and flags it, but throwing instances of 'NotImplementedException' is acceptable.

    I actually like the default behavior, because it does have this differentiation. NotImplementedException is not a temporary exception to be thrown while you're working your way through your code. It implies "I mean it, I'm really not going to implement this thing". If you leave the codegen the way it is, it's easy for you to differentiate in the code the "I will come back to this later" bits from "I've decided not to do this" bits.

提交回复
热议问题