using System; namespace ConsoleApp { class Program { static void Main(string[] args) { Console.WriteLine("Hello, World!"); } } }
using System; using System.Windows.Forms; namespace WindowsFormsApp { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { MessageBox.Show("Hello, World!"); } } }
using System; using System.Web.UI; namespace WebApplication { public partial class Default : Page { protected void Page_Load(object sender, EventArgs e) { Label1.Text = "Hello, World!"; } } }The above code creates a web page that displays the phrase `"Hello, World!"` using a label. The package libraries used are `System` and `System.Web.UI`.