1 // Compiler options: /unsafe
3 using System.Collections.Generic;
7 public static void Main ()
9 foreach (int item in GetItems ()) {
10 Console.WriteLine (item);
14 public static unsafe int GetItem ()
16 byte[] value = new byte[] { 0xDE, 0xAD, 0xBE, 0xEF };
18 fixed (byte* valueptr = value) {
19 return *(int*) valueptr;
23 public static IEnumerable<int> GetItems ()
25 yield return GetItem ();