Is there any 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)
I found the Reference "Add_Edit_Highlighting_Pattern". It seems to be the only way it can be done. You generate the default code, and then add a new pattern rule to change that code into an assert. You cannot actually change the original generated code - or so it seems.
The procedure described in another article "From ArgumentException to CodeContracts using Resharper"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With