Change the generated code to "Check if the parameter is zero"

Is there a way to change the code generated by resharper for the context action 'check if parameter is null'. I want to change it from

if (item == null) throw new ArgumentNullException("item"); 

to

 Contract.Requires(item != null) 
+7
source share
1 answer

I found the link "Add_Edit_Highlighting_Pattern" . This seems to be the only way to do this. You generate the default code, and then add a new template rule to modify that code in assert. You cannot change the source code generated - or so it seems.

The procedure described in another article From ArgumentException to CodeContracts using Resharper "

+5
source

All Articles