Shortest Hello World program with no semi colons

C# 85 chars

class H{static void Main(){if(System.Console.Out.WriteAsync("Hello, world!")is H){}}}

C# (114)

class M{static void Main(){if(typeof(System.Console).GetMethods()[78].Invoke(null,new[]{"Hello, world!"})is M){}}}

Note that the proper index for Write(string)/WriteLine(string) may be different on your system. However, since there are only 106 methods total, I'm almost certain either Write(string) or WriteLine(string) will be a two-digit index number on every system, so the character count should be generally valid.

Demo: http://ideone.com/5npky (Write method is apparently index 23 here)


C#, 76

class X{static void Main(){if(System.Console.Write("Hello, World!")is X){}}}

I tried this in my VS2012 and it works just fine, even though it is quite a surprise that you can apply the is operator to void...

Tags:

C#

Code Golf