Array.FindAll : Array « System « C# / C Sharp by API






Array.FindAll

  

using System;
using System.Collections;
using System.Collections.Generic;

public class MainClass {

    public static void Main() {
        int[] zArray = { 1, 2, 3, 1, 2, 3, 1, 2, 3 };
        Predicate<int> match = new Predicate<int>(MethodA<int>);
        int[] answers = Array.FindAll(zArray, match);
        foreach (int answer in answers) {
            Console.WriteLine(answer);
        }
    }

    public static bool MethodA<T>(T number) where T : IComparable {
        int result = number.CompareTo(3);
        return result == 0;
    }
}

   
    
  








Related examples in the same category

1.Array.AsReadOnly
2.Array.BinarySearch
3.Array.Clone
4.Array.ConvertAll
5.Array.Copy
6.Array.CopyTo
7.Array.Count
8.Array.CreateInstance
9.Array.Exists
10.Array.Find
11.Array.ForEach
12.Array.GetEnumerator()
13.Array.GetLength()
14.Array.GetLowerbound
15.Array.GetUpperBound
16.Array.IndexOf
17.Array.LastIndexOf
18.Array.Length
19.Array.Rank
20.Array.Resize
21.Array.Reverse
22.Array.Reverse(nums, 1, 3)
23.Array.Sort
24.Array.Sort(names, Comparer.DefaultInvariant)
25.Array.SyncRoot