You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
But we don't seem to follow that on C# .NET project templates.
For an example, consider the following examples.
ASP.NET Core Web API template.
// We can't determine what type the builder is by looking at right sidevarbuilder= WebApplication.CreateBuilder(args);
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen();// Same herevarapp= builder.Build();// code emitted for brevity
Azure Function Template
// We can't determine what type the host is by looking at right sidevarhost=new HostBuilder().ConfigureFunctionsWebApplication().ConfigureServices(services =>{ services.AddApplicationInsightsTelemetryWorkerService(); services.ConfigureFunctionsApplicationInsights();}).Build();// code emitted for brevity
Worker Service
// What's the type of the buildervarbuilder= Host.CreateApplicationBuilder(args);
builder.Services.AddHostedService<Worker>();// Samevarhost= builder.Build();
Describe the solution you'd like.
I am suggesting we follow the standard C# coding conventions.
ASP.NET Core Web API template.
// It's more readableWebApplicationBuilderbuilder= WebApplication.CreateBuilder(args);
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen();// It's more readableWebApplicationapp= builder.Build();
Azure Function Template
// It's more readableIHosthost=new HostBuilder().ConfigureFunctionsWebApplication().ConfigureServices(services =>{ services.AddApplicationInsightsTelemetryWorkerService(); services.ConfigureFunctionsApplicationInsights();}).Build();
Worker Service
// It's more readableHostApplicationBuilderbuilder= Host.CreateApplicationBuilder(args);
builder.Services.AddHostedService<Worker>();// It's more readableIHosthost= builder.Build();
Additional context
No response
The text was updated successfully, but these errors were encountered:
I am sorry if this is not the place to bring this up.
All the different C# .NET project templates (ASP.NET Core, Azure Functions etc.) creates templated code with incorrect use of
var
.Official .NET Coding Conventions nicely explains when to use
var
.But we don't seem to follow that on C# .NET project templates.
For an example, consider the following examples.
Describe the solution you'd like.
I am suggesting we follow the standard C# coding conventions.
Additional context
No response
The text was updated successfully, but these errors were encountered: