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

Use C# 12 features #806

Merged
merged 7 commits into from Oct 2, 2023
Merged

Conversation

martincostello
Copy link
Member

  • Use primary constructors where relevant.
  • Use collection literals where relevant.
  • Add helper method to reduce duplicative tests.
  • Apply some IDE suggestions.
  • Remove redundant using statements.
  • Fix some typos.
  • Hide shared files from the Visual Studio project explorer.

- Use primary constructors in test classes.
- Use collection literals
- Add helper method to reduce duplicative tests.
- Fix some typos.
Update test missed from refactor in previous commit.
Hide shared files from the Visual Studio project explorer.
- Use primary constructors where relevant.
- Use collection literals where relevant.
- Apply some IDE suggestions.
- Remove redundant using statements.
- Fix some typos.
Remove `<remarks>` from class documentation when primary constructor is used.
@martincostello martincostello marked this pull request as ready for review October 2, 2023 10:23
Copy link
Member

@kevinchalet kevinchalet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍🏻

samples/Mvc.Client/Startup.cs Outdated Show resolved Hide resolved
{
new AuthenticationToken() { Name = "access_token", Value = tokens.AccessToken },
};
List<AuthenticationToken> authTokens =
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Assuming we like the new syntax mostly for its terseness, maybe we should put everything on the same line when there's a single item added?

List<AuthenticationToken> authTokens = [new() { Name = "access_token", Value = tokens.AccessToken }];

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not going to change this one, at least for now, as doing so needs me to suppress SA1010 due to this bug.

Code reviewer prefers the older style.
Remove property and use constructor parameter to match `hostingEnvironment`.
@martincostello martincostello merged commit 3246aad into aspnet-contrib:dev-v8 Oct 2, 2023
8 checks passed
@martincostello martincostello deleted the csharp-12 branch October 2, 2023 11:24
@martincostello martincostello added this to the 8.0.0 milestone Oct 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants