Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Method parameters that are not written to, can be made readonly #292

Open
ynsehoornenborg opened this issue Jan 27, 2023 · 0 comments · May be fixed by #443
Open

Method parameters that are not written to, can be made readonly #292

ynsehoornenborg opened this issue Jan 27, 2023 · 0 comments · May be fixed by #443
Assignees
Labels
new analyzer New Diagnostic Analyzer

Comments

@ynsehoornenborg
Copy link
Contributor

Most collections have an read-only interface. Use that if the method doesn't write to the collection. This shows the caller that the collection stays unchanged and opens up the opportunity for them to use the read-only interface internally.

public int GetIndexOf(IReadOnlyList<int> list)
@ynsehoornenborg ynsehoornenborg added the new analyzer New Diagnostic Analyzer label Jan 27, 2023
@ynsehoornenborg ynsehoornenborg changed the title Method parameters that are not written too can be readonly Method parameters that are not written to, can be made readonly Jan 27, 2023
@ynsehoornenborg ynsehoornenborg self-assigned this Feb 18, 2023
@ynsehoornenborg ynsehoornenborg linked a pull request Feb 19, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new analyzer New Diagnostic Analyzer
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant