"In" parameter modifier for generated method signatures

Answered

When I let Rider generate method signatures for me it adds the "in" parameter modifier introduced in C# 7.2. Is there a way to disable this behaviour?

0
5 comments

Hello Maxim,

Can I please get an example of code? Any chance, you notice it when generate method for readonly structure?

0
Avatar
Permanently deleted user

Since you asked for a code sample:

private bool DoSomething() {
       bool result = DoSomethingByDate(DateTime.Today);

       return result;
}

If DoSomethingByDate doesn't exist yet and I want Rider to generate the method stub for me It will generate this:

private bool DoSomethingByDate(in DateTime date){
       throw new NotImplementedException();
}

0

If you check the implementation of DateTime, then you can find it is implemented as readonly struct, hence it is absolutely reasonable to add in modifier to it. In this case behavior is by design, there are no settings to change it. 

 
0

Could you please add an option to disable this bloat? the performance doesn't matter for 99% of the cases.

0

Thank you for your feedback. I have created a corresponding request for it on our issues tracker: RSPR-478989. We would appreciate it if you would upvote the issue in order to demonstrate additional interest. Also make sure to watch it for monitoring the progress.

0

Please sign in to leave a comment.