Skip to content

Hello World Recipes

rollynoel edited this page Jun 13, 2013 · 4 revisions

Added by Rodrigo B. de Oliveira

How many ways can you say Hello World?

This example shows console, WinForms and Gtk versions of "Hello, world!".

Console

print "Hello, world!"

WinForms

import System.Windows.Forms

f = Form(Text: "Hello, boo!")
f.Controls.Add(Button(Text: "Click Me!", Dock: DockStyle.Fill))

Application.Run(f)

Gtk#

import Gtk from "gtk-sharp"

Application.Init()

window = Window("Hello, boo!",
                DefaultWidth:  200,
                DefaultHeight: 150)

# The application should exit after the window is closed
window.DeleteEvent += def():
    Application.Quit ()

window.Add(Button("Click Me!"))
window.ShowAll()
Application.Run()
Clone this wiki locally