MicrosoftDocs / feedback

📢 docs.microsoft.com site feedback
https://learn.microsoft.com
Creative Commons Attribution 4.0 International
239 stars 160 forks source link

Use of var in ASP.NET Core Documentation seriously hampers clarity of examples #3960

Open hugovdb1965 opened 1 year ago

hugovdb1965 commented 1 year ago

ASP.NET Core Documentation extensively uses 'var' in example snippets. As the site does not have a mouseover that shows the type as VS does it makes the examples much less readable, often almost unreadable and fairly useless. copy/paste to VS does not solve this as most examples, by nature, are incomplete snippets and VS just shows a ton of errors.

Downloading the sample code has been suggested, but most documentation pages do not contain a full sample download.

This is a blatant violation of Microsoft's own C# coding guidelines (https://learn.microsoft.com/en-us/dotnet/csharp/fundamentals/coding-style/coding-conventions#implicitly-typed-local-variables), apparently the ASP.NET core unit is not willing to code by Microsoft's own guidelines.

What they do for their own code is not my concern, but for the doc examples it seriously impedes the usefulness of the docs.

Aside from that, strong typing is good for maintainability

Describe the solution you'd like Explicitly code return types in documentation examples instead of using 'var'

Describe alternatives you've considered Moving away from ASP.NET MVC altogether. We're porting from ASP.NET MVC 5 to ASP.NET Core MVC 8, and it's proving as much work as moving away from .NET altogether.

Additional context Nope.

welcome[bot] commented 1 year ago

Thank you for opening an issue! One of our team members will get back to you with additional information.

If this is a product issue, please close this issue and contact the product's support instead. For a list of support websites, see Support for Microsoft products and apps.