Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

C# program to search an element in an array

C# program for implementation of Quick sort

Are you a c# beginner or want to start learning the c# programming language, then this Program will help you to understand the basics of c# programming. In this program, we are going to share C# program to search an element in an array with the output.

  • Collection of 100+ C# problems with solutions.

Copy the below c# program and execute it in your Microsoft Visual Studio IDE (Integrated Development Environment ). At the end of this program, I have shared the output program.

using System;
using System.IO;
class Program
{
    static void Main()
    {
 
        string[] array1 = { "cat", "dogs", "donkey", "camel" };
        string v1 = Array.Find(array1,
            element => element.StartsWith("cam", StringComparison.Ordinal));
        string v2 = Array.Find(array1,
            element => element.Length == 3);
        Console.WriteLine("The Elemnt that Starts with 'Cam' is : " +v1);
        Console.WriteLine("3 Letter word in the Array is : " +v2);
        Console.ReadLine();
    }
}

Program Output

The Element that Starts With ‘Cam’ is: Camel
3 Letter Word in the Array is : cat

The post C# program to search an element in an array appeared first on FreeWebMentor.



This post first appeared on Programming Blog Focused On Web Technologies, please read the originial post: here

Share the post

C# program to search an element in an array

×

Subscribe to Programming Blog Focused On Web Technologies

Get updates delivered right to your inbox!

Thank you for your subscription

×