Array.LastIndexOf demo : Array Exist Find « Data Structure « C# / CSharp Tutorial






using System;

public class Example
{
    public static void Main()
    {
        string[] letters = { "A","B","C","F","D","A","E" };

        Console.WriteLine("\nArray.LastIndexOf(letters, \"A\"): {0}", Array.LastIndexOf(letters, "A"));

        Console.WriteLine("\nArray.LastIndexOf(letters, \"A\", 3): {0}", Array.LastIndexOf(letters, "A", 3));

        Console.WriteLine("\nArray.LastIndexOf(letters, \"A\", 4, 4): {0}", Array.LastIndexOf(letters, "A", 4, 4));
    }
}








11.14.Array Exist Find
11.14.1.Demonstrate Predicate delegate
11.14.2.Use Array.Exists to check if a certain element exist
11.14.3.Use Array.Find to find array elements end with s
11.14.4.Use Array.FindLast to find the string element ends with s
11.14.5.Array.FindAll
11.14.6.All three generic overloads of the Array.IndexOf method.
11.14.7.Array.LastIndexOf demo
11.14.8.Using Array.TrueForAll for testing if array elements all end with string s