/* * Eina Iterator examples. * * These examples demonstrate how to work with eina_iterator methods. * Both an eina_list and an eina_array are created and an iterator obtained * for both. You can see how we can use iterators irrespective of the source * and also that there are different ways to work with iterating content. */ using System; public class Example { static void PrintIterator(eina.Iterator it) { Console.WriteLine("--iterator start--"); foreach(string s in it) Console.WriteLine(s); Console.WriteLine("-- iterator end --"); } static eina.Array CreateArray() { string[] strings = { "name strings", "husker", "starbuck", "boomer" }; var array = new eina.Array(4u); foreach (string s in strings) array.Push(s); return array; } static eina.List CreateList() { string[] more_strings = { "sentence strings", "what do your hear?", "nothing but the rain", "then grab your gun and bring the cat in" }; var list = new eina.List(); foreach (string s in more_strings) list.Append(s); return list; } public static void Main() { efl.All.Init(); // create an eina.Array and iterate through it's contents var array = CreateArray(); var it = array.GetIterator(); PrintIterator(it); it.Dispose(); array.Dispose(); // perform the same iteration with an eina.List var list = CreateList(); it = list.GetIterator(); PrintIterator(it); it.Dispose(); list.Dispose(); efl.All.Shutdown(); } }