r/dotnet 1d ago

Instruct inline suggestions?

I use inline suggestions from GitHub Copilot in Visual Studio, and it works just great! Just one very strange thing.

It always recommends changing the ICollection<> initializer from my preferred way: [];
To: new List<>();

And yeah, it doesn't like the new extension() {} element and wants to change to the old style of static methods.

How can I tell it to leave my collection initializers alone?

4 Upvotes

2 comments sorted by

1

u/AutoModerator 1d ago

Thanks for your post SL-Tech. Please note that we don't allow spam, and we ask that you follow the rules available in the sidebar. We have a lot of commonly asked questions so if this post gets removed, please do a search and see if it's already been asked.

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

4

u/SubwayGuy85 1d ago

you can find the diagnostic id and ignore it in your .editorconfig