Exemplo n.º 1
0
 public static Array <T> CastGodotArray <T>(this IEnumerable source)
 {
     if (source is Godot.Collections.Array arr)
     {
         return(arr.Cast <T>());
     }
     ErrCheck.Null(source, nameof(source));
     return(new Array <T>(new Godot.Collections.Array(source)));
 }
Exemplo n.º 2
0
        public static bool Any(this IEnumerable source)
        {
            ErrCheck.Null(source, nameof(source));
            var enumerator = source.GetEnumerator();

            if (enumerator is IDisposable disposable)
            {
                using (disposable) return(enumerator.MoveNext());
            }
            return(enumerator.MoveNext());
        }
Exemplo n.º 3
0
 public static bool Any(this IEnumerable source, Predicate <object> predicate)
 {
     ErrCheck.Null(source, nameof(source));
     ErrCheck.Null(predicate, nameof(predicate));
     foreach (var i in source)
     {
         if (predicate(i))
         {
             return(true);
         }
     }
     return(false);
 }
Exemplo n.º 4
0
 public static Array <T> Cast <T>(this Godot.Collections.Array source)
 {
     ErrCheck.Null(source, nameof(source));
     return(new Array <T>(source));
 }
Exemplo n.º 5
0
 public static Array <T> ToGodotArray <T>(this IEnumerable <T> source)
 {
     ErrCheck.Null(source, nameof(source));
     return(new Array <T>(source));
 }
Exemplo n.º 6
0
 public static Godot.Collections.Array ToGodotArray(this IEnumerable source)
 {
     ErrCheck.Null(source, nameof(source));
     return(new Godot.Collections.Array(source));
 }