static string[] ConvertIterableToArray(Java.Lang.IIterable iterable)
        {
            var items    = new List <string>();
            var iterator = iterable.Iterator();

            while (iterator.HasNext)
            {
                var item = (string)iterator.Next();
                items.Add(item);
            }

            return(items.ToArray());
        }
Ejemplo n.º 2
0
 public static IEnumerable <T> ToEnumerable <T> (this Java.Lang.IIterable source)
 {
     if (source == null)
     {
         throw new ArgumentNullException("source");
     }
     using (var iterator = source.Iterator())
         while (iterator.HasNext)
         {
             yield return(JavaConvert.FromJniHandle <T>(
                              JNIEnv.CallObjectMethod(iterator.Handle, id_next),
                              JniHandleOwnership.TransferLocalRef));
         }
 }