The right way of writing hello world with iterators:
using System.Collections;
using System;
class Hello {
static IEnumerable GetMessage ()
{
yield "Hello";
yield ", ";
yield "World";
yield "\n";
}
static void Main ()
{
foreach (string s in GetMessage ())
Console.WriteLine (s);
}
}
Compile with love and run, but do not forget the -v2 option:
mcs -v2 hello.cs
mono hello.exe
Miguel.