using System; namespace MyConsoleApp { class Program { static void Main(string[] args) { Console.WriteLine("Hello, World!"); } } }
using System; using System.Windows.Forms; namespace MyWinFormsApp { class Program : Form { static void Main(string[] args) { Application.Run(new Program()); } public Program() { Text = "My WinForms App"; } } }
using System; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Http; namespace MyWebApp { class Program { static void Main(string[] args) { var host = new WebHostBuilder() .UseKestrel() .Configure(app => app.Run(async context => { await context.Response.WriteAsync("Hello, World!"); })) .Build(); host.Run(); } } }This example shows how to create a simple ASP.NET web application in C#. The `Microsoft.AspNetCore` namespace is used, and the `WebHostBuilder` class is used to configure the application. The `app => app.Run()` lambda expression defines the request pipeline, which in this case simply writes "Hello, World!" to the response. Package/library: ASP.NET Core Web Application Framework