Exemple #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)));
 }
Exemple #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());
        }
Exemple #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);
 }
Exemple #4
0
 public static Array <T> Cast <T>(this Godot.Collections.Array source)
 {
     ErrCheck.Null(source, nameof(source));
     return(new Array <T>(source));
 }
Exemple #5
0
 public static Array <T> ToGodotArray <T>(this IEnumerable <T> source)
 {
     ErrCheck.Null(source, nameof(source));
     return(new Array <T>(source));
 }
Exemple #6
0
 public static Godot.Collections.Array ToGodotArray(this IEnumerable source)
 {
     ErrCheck.Null(source, nameof(source));
     return(new Godot.Collections.Array(source));
 }