L
L
lssssssssssl2021-11-29 19:54:41
C++ / C#
lssssssssssl, 2021-11-29 19:54:41

Why does the default template have one Program.cs instead of Program.cs and Startup.cs?

In all the repositories and guides that I found, people in the original template have a different structure than the one that is generated by me.
61a505b6989f0614865250.png

And there is no class declaration in the Program.cs file. In principle, it’s even more convenient for me personally, but what is the reason for this?

ps I have very little practical experience in c#, so it is desirable to be more detailed, if possible.

Thanks to.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vasily Bannikov, 2021-11-29
@lsssssssssl

I will assume that you have seen the new template from .net 6:

var builder = WebApplication.CreateBuilder(args);
var app = builder.Build();
app.MapGet("/", () => "hello world");
app.Run();

.NET 6 introduced a new, more compact syntax that replaces Startup.cs.
Google on the phrase "asp net core minimal api"
If you really want to, you can create Startup.cs by hand, it has not been deleted.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question