Digg StumbleUpon LinkedIn YouTube Flickr Facebook Twitter RSS Reset

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

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);
    }
}
 
 }

No comments yet.

Leave a Comment