Count string values stored in an array in CSharp

Description

The following code shows how to count string values stored in an array.

Example


   /*from   ww  w .  j a  v a2 s.  c o m*/

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

public class MainClass {
    public static void Main() {
        string[] presidents = {"HTML", "HTML5", "CSS", "CSS5", "Java", "Javascript"};
        int count = presidents.Count();
        Console.WriteLine(count);
    }
}

The code above generates the following result.





















Home »
  C# Tutorial »
    LINQ »




Operator
Select
Where
OrderBy
Group
Join
Let
LINQ