Skip to content

Return Array.Empty instead of collection [] #25137

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

Merged

Conversation

ArmaanMcleod
Copy link
Contributor

@ArmaanMcleod ArmaanMcleod commented Mar 7, 2025

PR Summary

Return Array.Empty instead of collection [].

Missed this in #25126 (comment)

PR Context

PR Checklist

@ArmaanMcleod
Copy link
Contributor Author

@iSazonov do you have issues with VSCode and editorconfig not using rules? I still get recommendation to use [] for this code.

@iSazonov
Copy link
Collaborator

iSazonov commented Mar 7, 2025

@ArmaanMcleod I played with the option, and it works for me in VS Code. Maybe you need restart? Or not
https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/style-rules/ide0301 rule but the
https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/style-rules/ide0300 rule works for you?

Learn about code analysis rule IDE0301: Use collection expression for empty
Learn about code analysis rule IDE0300: Use collection expression

@ArmaanMcleod ArmaanMcleod changed the title Return Enumerable.Empty instead of collection [] Return Array.Empty instead of collection [] Mar 7, 2025
@ArmaanMcleod
Copy link
Contributor Author

ArmaanMcleod commented Mar 7, 2025

@ArmaanMcleod I played with the option, and it works for me in VS Code. Maybe you need restart? Or not https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/style-rules/ide0301 rule but the https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/style-rules/ide0300 rule works for you?

**IDE0301: Use collection expression for empty - .NET**Learn about code analysis rule IDE0301: Use collection expression for empty

**IDE0300: Use collection expression for array - .NET**Learn about code analysis rule IDE0300: Use collection expression

Thanks @iSazonov. I will play around with it, maybe need to reinstall extension.

Learn about code analysis rule IDE0301: Use collection expression for empty
Learn about code analysis rule IDE0300: Use collection expression

@iSazonov

This comment was marked as outdated.

This comment was marked as outdated.

@iSazonov iSazonov added the CL-CodeCleanup Indicates that a PR should be marked as a Code Cleanup change in the Change Log label Mar 7, 2025
@iSazonov iSazonov self-assigned this Mar 7, 2025
@iSazonov iSazonov merged commit 210ca83 into PowerShell:master Mar 7, 2025
39 of 41 checks passed
Copy link
Contributor

microsoft-github-policy-service bot commented Mar 7, 2025

📣 Hey @ArmaanMcleod, how did we do? We would love to hear your feedback with the link below! 🗣️

🔗 https://aka.ms/PSRepoFeedback

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CL-CodeCleanup Indicates that a PR should be marked as a Code Cleanup change in the Change Log
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy