Digg StumbleUpon LinkedIn YouTube Flickr Facebook Twitter RSS Reset

Générique avec Collection et Liste

Non,Edité
{filelink=17501}

using System;
using System.Collections.ObjectModel;
using System.Collections.Generic;
using System.Text;
using System.Runtime.Serialization;
 
public class CollectionListGenerique
{
    public static void Main()
    {
 
        List<String> listString = new List<String>();
        listString.Add("A");
        listString.Add("B");
        listString.Add("C");
        listString.Add("D");
 
        Collection<String> collectionString = new Collection<String>(listString);
 
        foreach (String valeur in collectionString)
            System.Console.WriteLine(valeur);
 
        listString[0] = "Valeur changée";
 
        foreach (String elem in collectionString)
            System.Console.WriteLine(elem);
    }
}

No comments yet.

Leave a Comment