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)
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
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“