Difference between tuples and other objects

0

What is the difference between tuples and collections, list or dictionay .

Comparisons can be made in the tuples , which is the advantage of using them.

    
asked by Sergio ibañez 10.01.2018 в 22:23
source

1 answer

0

A difference between Tuples and collections that I see is that in the first you can use different types of data and in the collections [generic you can only specify a data type!

(string x , int y, bool z) = ("benjamin",30,true);
        Console.WriteLine($"{x}: {y}: {z}");

//Listas
           List<string> lista = new List<string>();
       lista.Add("uno");
       lista.Add("dos");
          foreach(string s in lista) 
        Console.WriteLine(s);

    
answered by 14.01.2018 в 05:04