LINQ: Afficher la taille moyenne de caractère d’une liste de ‘String’

Author:

LINQ, All, Any, Concat, Contains, Agrégat, Union, Select, Order, From, Where
{filelink=15077}

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

namespace LINQ
{

public class ExempleAnyAvergae
{
    public static void Main()
	{
        string[] words = { "Paris", "New York", "Berlin", "Madrid", "Londre", "Milan" };

        double averageLength = words.Average(w => w.Length);

        Console.WriteLine("The average word length is {0} characters.", averageLength);
    }
}

 }

Leave a Reply

Your email address will not be published. Required fields are marked *