Consider add a new language "C# Program with Namespace"?

edited March 2019
Somethings we create a ASP.NET Core MVC demo using LINQPad, but the controller need to be in namespace(instead of in class), this way, code would be a little messy here:

void Main()
{
WebHost
.CreateDefaultBuilder()
.UseStartup<Startup>()
.UseUrls("https://localhost:55555")
.Build()
.Start();
}

class Startup
{
public void ConfigureServices(IServiceCollection services)
{
services.AddMvc();
}

public void Configure(IApplicationBuilder app)
{
app.UseMvcWithDefaultRoute();
}
}
}
namespace Controllers
{
public class HomeController : Controller
{
public string Index()
{
return "Hello World";
}
}
}

class EOF {
Is that possible to add a "C# Program with Namespace" way, to make the code much simpler(maybe like this):

namespace App
{
class EntryPoint : UserQuery
{
static void Main()
{
WebHost
.CreateDefaultBuilder()
.UseStartup<Startup>()
.UseUrls("https://localhost:55555")
.Build()
.Start();
}
}

public class HomeController : Controller
{
public string Index()
{
return "Hello World";
}
}

class Startup
{
public void ConfigureServices(IServiceCollection services)
{
services.AddMvc();
}

public void Configure(IApplicationBuilder app)
{
app.UseMvcWithDefaultRoute();
}
}
}

Comments

Sign In or Register to comment.