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

前端 未结 2 397
闹比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:09

    Taken from: http://blogs.msdn.com/ansonh/archive/2005/12/08/501763.aspx

    Visual Studio 2005 supports targeting the 1.0 version of the compact framework. In order to keep the size of the compact framework small, it does not include all of the same types that exist in the desktop framework. One of the types that is not included is NotImplementedException.

    You can change the generated code by editing the code snippet file: C:\Program Files\Microsoft Visual Studio 8\VC#\Snippets\1033\Refactoring\MethodStub.snippet and changing the Declarations section to the following:

            
                
                    signature
                    signature
                
                
                    Exception
                    SimpleTypeName(global::System.NotImplementedException)
                
            
    

提交回复
热议问题